I have a XData server app using HTTPSys that works ok. Testing the same app on Linux using INDY I get ACCESS_VIOLATION exception on "TStream.SetPosition". I have tested on Windows and Linux with same results.
I have found the cuase of the error. The client send compressed data as deflate(no compression works ok) and I have a decompress middleware with the following code.
Thanks in advance,
Omar Zelaya
if Context.Request.Headers.Get('content-encoding') = 'deflate' then
begin
TempStream := TMemoryStream.Create;
try
repeat
BytesRead := Context.Request.ContentStream.Read(Buffer[0], BufSize);
TempStream.Write(Buffer[0], BytesRead);
until BytesRead <> BufSize;
TempStream.Position := 0;
Context.Request.ContentStream.Free;
Context.Request.ContentStream := TZDecompressionStream.Create(TempStream, 15, True);
Context.Request.Headers.SetValue('content-length', '-1');
except
TempStream.Free;
raise;
end;
end