cli tool: reimplement stdin buffering in -F option.

If stdin is not a regular file, its content is memory-buffered to enable
a possible data "rewind".
In all cases, stdin data size is determined before real use to avoid
having an unknown part's size.

--libcurl generated code is left as an unbuffered stdin fread/fseek callback
part with unknown data size.

Buffering is not supported in deprecated curl_formadd() API.
This commit is contained in:
Patrick Monnerat 2017-10-12 14:25:59 +01:00
parent f64c05278e
commit 665b3e48bc
3 changed files with 153 additions and 14 deletions

View file

@ -53,11 +53,9 @@ POST /we/want/173 HTTP/1.1
User-Agent: curl/7.12.1-CVS (i686-pc-linux-gnu) libcurl/7.12.1-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.6
Host: %HOSTIP:%HTTPPORT
Accept: */*
Transfer-Encoding: chunked
Expect: 100-continue
Content-Length: 360
Content-Type: multipart/form-data; boundary=----------------------------5dbea401cd8c
168
------------------------------5dbea401cd8c
Content-Disposition: form-data; name="field1"
@ -76,9 +74,6 @@ line7
line8
------------------------------5dbea401cd8c--
0
</protocol>
</verify>
</testcase>