On Sat, 11 Jan 2014, Cédric Deltheil wrote:
When performing a standard HTTP POST (w/o chunked encoding) with a custom
read function, a common mistake is to forget to explicitly set the POST size
via `CURLOPT_POSTFIELDSIZE`.
This results in libcurl sending a negative content length:
Content-Length: -1
, which gives a bad request.
The question is: should we prevent libcurl to send the request by failing
early?
Yes I think so. Sending -1 is plain wrong.
Before sending a patch, I was wondering if `CURLE_UPLOAD_FAILED` would be
the best error code to use there.
Sure. With a decent failf() as well it should be fine.
It'd also be great to have a test case or two for this. See tests/libtest/ for
inspiration!
--
/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html