Hi,
I think there is a problem with the read of the content body when source code is compiled for a linux platform. I have the following code on "onDataReceived" which runs perfectly on windows (and on linux for small contents):
procedure THttpSrv.DataProv_DataReceived(Sender: TRtcConnection);
var
FJson: RtcWideString;
begin
with TRtcDataServer(Sender) do
try
if Request.Complete then
begin
if Request.Method = 'GET' then
Write('extOrder API: POST method should be used to access API')
else
begin
FJson := Read; // [b]<-- here is the problem: different result on windows and linux[/b]
if FJson <> '' then
begin
FJson := JSON_DecodeString(FJson);
Log(msgDebug, Request.Host, FJson);
end;
end;
end;
except
on e: Exception do
Write(e.Message);
end;
end;
when I compile the server for windows platform, I get the payload (through TRtcDataServer(Sender).Read) no matter how big the payload is. On linux, when the payload is small, everything is working as expected. But for large payload (i.e. large JSON's) I get the last part of the payload (I never get the beginning of the message). Have you got any idea why is this happening? I tried to find out if the read function has something like chunked receive (and the "read" function runs twice and overrides the first part) but I couldn't find something... (I'm waiting for the "Request.Complete" anyway). Looking in demos and examples, we only have cases how to "send" large files, not "get" ones from clients.
By the way, the "ContentIn" and "ContentLength" Variables has the same value on both Windows and Linux...
Thanks in advanced for any help,
Stefanos