Re: HTTP POST: fail early if unknown data size (read function)

2014-01-19 Thread Cédric Deltheil
Le 14 janv. 2014 à 11:31, Cédric Deltheil ced...@moodstocks.com a écrit : Ah yes. Since PUT already works like that, I think it is a good reason for us to make POST do the same! Please find attached a tiny patch including a new test case (test1514). HTTP-POST-patches.tar.gz Description:

Re: HTTP POST: fail early if unknown data size (read function)

2014-01-14 Thread Cédric Deltheil
Le 13 janv. 2014 à 16:08, Daniel Stenberg dan...@haxx.se a écrit : I compared what happens with an HTTP PUT request if the caller forgot to set the expected size via `CURLOPT_INFILESIZE`: in that case, the Content-Length header is omitted (and thus libcurl does not send any negative

Re: HTTP POST: fail early if unknown data size (read function)

2014-01-13 Thread Cédric Deltheil
Le 12 janv. 2014 à 22:20, Rich Gray rg...@plustechnologies.com a écrit : Although it is probably the closest code for this error, CURLE_UPLOAD_FAILED seems wrong. In my mind, it implies a wire error, Just a precision: the corresponding error string is Upload failed (at start/before it took

Re: HTTP POST: fail early if unknown data size (read function)

2014-01-13 Thread Daniel Stenberg
On Sun, 12 Jan 2014, Cédric Deltheil wrote: I compared what happens with an HTTP PUT request if the caller forgot to set the expected size via `CURLOPT_INFILESIZE`: in that case, the Content-Length header is omitted (and thus libcurl does not send any negative Content-Length). Ah yes. Since

Re: HTTP POST: fail early if unknown data size (read function)

2014-01-12 Thread Cédric Deltheil
Le 12 janv. 2014 à 00:19, Daniel Stenberg dan...@haxx.se a écrit : The question is: should we prevent libcurl to send the request by failing early? Yes I think so. Sending -1 is plain wrong. After a quick code review I have several questions I would like to discuss: I compared what

Re: HTTP POST: fail early if unknown data size (read function)

2014-01-12 Thread Rich Gray
Daniel Stenberg wrote: 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

HTTP POST: fail early if unknown data size (read function)

2014-01-11 Thread Cédric Deltheil
Hi all, 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

Re: HTTP POST: fail early if unknown data size (read function)

2014-01-11 Thread Daniel Stenberg
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: