On Sun, 18 Jan 2015, leledumbo wrote:

Yes, I can. The TFPHTTPClient instance is not stateless.

Before doing a call, some headers are added to the request headers if they
are not there yet.
For example, the Content-Size header.

But the Content-Size header is not added if is already present.
For calls 1 and 2 it does not matter, since the size is the same.

For the third call, however, it does matter, since the content-size header
still contains the size of call 2 (93),
which does not match the size of call 3: call 3 has less data (57).

So the server is waiting for more data (it expects 93 bytes as indicated
in Content-Size instead of 57 actually present).

The solution is simple: Try clearing the headers before doing your calls.

   WriteLn('Response 2:');
   HTTP.RequestHeaders.Clear;

etc. then it will work. (it does here)

This is the answer I need, thanks :)

Looks like this needs some kind of documentation or at least comment
somewhere in the source.

Will do.


I still wonder why the header is not updated based on given parameters
though...

Because the header may have been set on purpose by the user.

I will look at a mechanism to remove headers that were 'automatically' added.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to