TIndySparkleHTTPServer Exception

Hi,

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.

Any hint?

Thanks in advance,

Omar Zelaya

Code:

XDataServer1.BaseUrl := 'http://localhost:8081/INTEC/ICSAT/xdata';
FIndyServer := TIndySparkleHTTPServer.Create(nil);
FIndyServer.DefaultPort := 8081;
FIndyServer.Dispatcher.AddModule(XDataServer1.CreateModule);
FIndyServer.Active := true;
FIndyServer.StartListening;

image

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

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.