[fpc-pascal] TFPHTTPClient Post works with jetty, fails with tomcat
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Mon Dec 19 10:39:09 CET 2011
On Mon, 19 Dec 2011, Mattias Gaertner wrote:
> On Mon, 19 Dec 2011 09:27:16 +0100 (CET)
> michael.vancanneyt at wisa.be wrote:
>
>>
>>
>> On Mon, 19 Dec 2011, Mattias Gaertner wrote:
>>
>>> Hi,
>>>
>>> For some reason TFPHTTPClient.Post hangs when accessing a "solr"
>>> server over "tomcat". It works with "solr" over "jetty".
>>> "curl" works fine with both, so I guess the tomcat server works
>>> normally.
>>>
>>> Here is the code:
>>>
>>> client:=TFPHTTPClient.Create(nil);
>>> client.RequestHeaders.Add('Content-Type: text/xml');
>>> client.RequestBody:=ms; // a TMemoStream with some xml to post
>>> client.Post(URL);
>>>
>>> It hangs here:
>>>
>>> procedure TFPCustomHTTPClient.ReadResponse
>>> ...
>>> else if L<0 then
>>> // No content-length, so we read till no more data available.
>>> Repeat
>>> R:=Transfer(ReadBufLen);
>>> until (R=0);
>>>
>>> Is there a remedy?
>>
>> Can you check what happens with strace?
>>
>> It means that the server didn't send a 'content-length' header, which is
>> strange in itself.
>
> Yes, it does not send the Content-Length.
> The comment is right.
> If I skip the repeat loop, it works, but I don't get the response.
> The response is a small xml snippet.
What does 'strace' say ?
Michael.
More information about the fpc-pascal
mailing list