Instead of making the change you've made, I would recommend adding a check after Dec(LenToSend,DataOut) in the TriggerDataOut method inside the same unit (rtcSocketHttpSrvProv.pas):
procedure TRtcSocketHttpServerProvider.TriggerDataOut;
var
nmd:boolean;
begin
nmd:=False;
Response.Started:=False;
if LenToSend>=0 then
begin
Dec(LenToSend, DataOut);
if LenToSend<0 then
raise Exception.Create('FATAL ERROR in TRtcSocketHttpServerProvider: More Data Out than Data Sent?');
end;
if LenToSend=0 then
nmd:=(InBuffer='') and not Request.Close;
inherited TriggerDataOut;
if nmd then
NeedMoreData;
end;
If that exception does happen in your Project, then I will need an example Project which demonstrates the issue, with instructions on how to reproduce it, so I can perform my own tests to find out what is wrong.
Best Regards,
Danijel Tkalcec