diff --git a/CHANGES b/CHANGES index 92b737589515a3c98a5b46f3c668f5fdbae6a167..bb05cb93f38f235071d5305a60c3a028de43ff4c 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,11 @@ Changelog +Daniel Stenberg (7 Dec 2009) +- Martin Storsjo made libcurl use the Expect: 100-continue header for posts + with unknown size. Previously it was only used for posts with a known size + larger than 1024 bytes. + Daniel Stenberg (1 Dec 2009) - If the Expect: 100-continue header has been set by the application through curl_easy_setopt with CURLOPT_HTTPHEADER, the library should set diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f6b38ce4500ef12d5c9e18ec7e69950c35042222..d916d438d687191c3aece1cf12f2d1fc5f952402 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -12,6 +12,7 @@ This release includes the following changes: o support SSL_FILETYPE_ENGINE for client certificate o curl-config can now show the arguments used when building curl o non-blocking TFTP + o send Expect: 100-continue for POSTs with unknown sizes This release includes the following bugfixes: diff --git a/lib/http.c b/lib/http.c index d67a001b26b53d10b190ee844fe9093721d4a0a3..6ac2d733102ce417138234f5b0a30842b8e8af2f 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2815,7 +2815,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) /* figure out the size of the postfields */ postsize = (data->set.postfieldsize != -1)? data->set.postfieldsize: - (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0); + (data->set.postfields? (curl_off_t)strlen(data->set.postfields):-1); } if(!data->req.upload_chunky) { /* We only set Content-Length and allow a custom Content-Length if @@ -2849,7 +2849,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) data->state.expect100header = Curl_compareheader(ptr, "Expect:", "100-continue"); } - else if(postsize > TINY_INITIAL_POST_SIZE) { + else if(postsize > TINY_INITIAL_POST_SIZE || postsize < 0) { result = expect100(data, conn, req_buffer); if(result) return result; diff --git a/tests/data/test510 b/tests/data/test510 index 360d6e96ee3d6e38f66d294e9a12d4b331069fac..8313f51c35ded8e9053be784329c99a222db880f 100644 --- a/tests/data/test510 +++ b/tests/data/test510 @@ -40,6 +40,7 @@ Host: %HOSTIP:%HTTPPORT Accept: */* Transfer-Encoding: chunked Content-Type: application/x-www-form-urlencoded +Expect: 100-continue 3 one diff --git a/tests/data/test565 b/tests/data/test565 index 896db4061bf512671f0bb81586bfb1d6782e7115..838941fefb927e834998990f74660a3e2da0998a 100644 --- a/tests/data/test565 +++ b/tests/data/test565 @@ -88,6 +88,7 @@ Host: 127.0.0.1:8990 Accept: */* Transfer-Encoding: chunked Content-Type: application/x-www-form-urlencoded +Expect: 100-continue 3 one