1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

- If the Expect: 100-continue header has been set by the application through

curl_easy_setopt with CURLOPT_HTTPHEADER, the library should set
  data->state.expect100header accordingly - the current code (in 7.19.7 at
  least) doesn't handle this properly. Martin Storsjo provided the fix!
This commit is contained in:
Daniel Stenberg 2009-12-01 12:04:54 +00:00
parent d61690ef46
commit f0826974f2
3 changed files with 29 additions and 10 deletions

View File

@ -7,6 +7,12 @@
Changelog Changelog
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
data->state.expect100header accordingly - the current code (in 7.19.7 at
least) doesn't handle this properly. Martin Storsjo provided the fix!
Yang Tse (28 Nov 2009) Yang Tse (28 Nov 2009)
- Added Diffie-Hellman parameters to several test harness certificate files in - Added Diffie-Hellman parameters to several test harness certificate files in
PEM format. Required by several stunnel versions used by our test harness. PEM format. Required by several stunnel versions used by our test harness.

View File

@ -28,6 +28,7 @@ This release includes the following bugfixes:
o SSL lib post-close write o SSL lib post-close write
o curl failed to report write errors for tiny failed downloads o curl failed to report write errors for tiny failed downloads
o TFTP BLKSIZE o TFTP BLKSIZE
o Expect: 100-continue handling when set by the application
This release includes the following known bugs: This release includes the following known bugs:
@ -39,6 +40,6 @@ advice from friends like these:
Yang Tse, Kamil Dudka, Christian Schmitz, Constantine Sapuntzakis, Yang Tse, Kamil Dudka, Christian Schmitz, Constantine Sapuntzakis,
Marco Maggi, Camille Moncelier, Claes Jakobsson, Kevin Baughman, Marco Maggi, Camille Moncelier, Claes Jakobsson, Kevin Baughman,
Marc Kleine-Budde, Jad Chamcham, Bjorn Augustsson, David Byron, Marc Kleine-Budde, Jad Chamcham, Bjorn Augustsson, David Byron,
Markus Koetter, Chad Monroe Markus Koetter, Chad Monroe, Martin Storsjo
Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)

View File

@ -1981,18 +1981,25 @@ static CURLcode expect100(struct SessionHandle *data,
send_buffer *req_buffer) send_buffer *req_buffer)
{ {
CURLcode result = CURLE_OK; CURLcode result = CURLE_OK;
const char *ptr;
data->state.expect100header = FALSE; /* default to false unless it is set data->state.expect100header = FALSE; /* default to false unless it is set
to TRUE below */ to TRUE below */
if(use_http_1_1(data, conn) && !checkheaders(data, "Expect:")) { if(use_http_1_1(data, conn)) {
/* if not doing HTTP 1.0 or disabled explicitly, we add a Expect: /* if not doing HTTP 1.0 or disabled explicitly, we add a Expect:
100-continue to the headers which actually speeds up post 100-continue to the headers which actually speeds up post operations
operations (as there is one packet coming back from the web (as there is one packet coming back from the web server) */
server) */ ptr = checkheaders(data, "Expect:");
if (ptr) {
data->state.expect100header =
Curl_compareheader(ptr, "Expect:", "100-continue");
}
else {
result = add_bufferf(req_buffer, result = add_bufferf(req_buffer,
"Expect: 100-continue\r\n"); "Expect: 100-continue\r\n");
if(result == CURLE_OK) if(result == CURLE_OK)
data->state.expect100header = TRUE; data->state.expect100header = TRUE;
} }
}
return result; return result;
} }
@ -2837,7 +2844,12 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
the somewhat bigger ones we allow the app to disable it. Just make the somewhat bigger ones we allow the app to disable it. Just make
sure that the expect100header is always set to the preferred value sure that the expect100header is always set to the preferred value
here. */ here. */
if(postsize > TINY_INITIAL_POST_SIZE) { ptr = checkheaders(data, "Expect:");
if(ptr) {
data->state.expect100header =
Curl_compareheader(ptr, "Expect:", "100-continue");
}
else if(postsize > TINY_INITIAL_POST_SIZE) {
result = expect100(data, conn, req_buffer); result = expect100(data, conn, req_buffer);
if(result) if(result)
return result; return result;