Hi
I am using THttpConnection.AnswerString from file OverbyteIcsHttpSrv and want
to send several answers in a long running request via transfer-encoding
"chunked".
What do I have to do for this to be possible? FKeepAliveTimeSec is zero, I set
the header of the response before calling answerString. Here my code:
response.ContentType:= 'text/json';
response.Param['transfer-encoding']:= 'chunked' ; //does not work with
additional the CRLF either.
response.Content:= '{ „Progress“: { „Ticket“: „-1“, „Operation“:
„StillRunning...“ }}';
response.Content := IntToHex(Length(response.Content),4) + #13#10 +
response.Content + #13#10;
Request.Answer( response );
Sleep(500);
response.Content:= '{"Parameter": "long", "Information": "Sorry that it
took so long"}';
response.Content := IntToHex(Length(response.Content),4) + #13#10 +
response.Content + #13#10;
response.Content := response.Content + '0' + #13#10 + #13#10;
Request.Answer( response );
With Request.Answer
procedure TAtServerRequestWebICS.Answer( _response: TAtServerResponse );
var
flags: THttpGetFlag;
begin
FConnection.AnswerString( flags
, '' {Default Status '200 OK'}
, _response.ContentType
, _response.Params // 'transfer-encoding: chunked'#$D#$A
, _response.Content ); // '003E'#$D#$A'{ „Progress“: { „Ticket“:
„-1“, „Operation“: „StillRunning...“ }}'#$D#$A
end {Answer};
Debugging the code, I run through both calls to answerString, but only one is
sent, it seems.
It seems that the FBufHandler in TCustomWSocket.PutDataInSendBuffer is nil.
Thank you
--
Ralph M. Rickenbach - phone +41 52 536 34 65 - mobile +41 78 697 05 21 - email
[email protected]
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be