Re: How to handle a response with an empty body
Date: Sun, 10 May 2020 11:45:59 +0200 (CEST)
On Sun, 10 May 2020, Konrad Mathieu via curl-users wrote:
(just note that you're asking this on the mailing list for the curl tool, not
one made for libcurl or for PHP/CURL users)
> Curl (in php) will for good reasons not close the connection but prompt an
> error along the lines of "no chunk, no close, no size. Assume close to
> signal end".
That tells us the server returns a body in HTTP/1.0-style, which is...
ineffective and annoying. A server should ideally better indicate end of body.
> So here's my question: How can I make curl accept the non-standard behaviour
> and still close the connection and return just the header?
That's not non-standard, it's just silly. The end of the body is signalled by
the server when it closes the connection.
You can return an error in the write callback to make curl stop handling the
body (and return an error).
-- / daniel.haxx.se | Commercial curl support up to 24x7 is available! | Private help, bug fixes, support, ports, new features | https://www.wolfssl.com/contact/ ----------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2020-05-10