aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-12-01 12:04:54 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-12-01 12:04:54 +0000
commitf0826974f225b71a9b95f76f8ac68ea0d72706d5 (patch)
tree45a9a53f16c1c8ce4547f2bc59b8ebf6f0d1a5b6 /lib/http.c
parentd61690ef46dad8912e33b0b48e7cf7c2ecdb25e7 (diff)
- 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!
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/http.c b/lib/http.c
index 7e4e58795..d67a001b2 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1981,17 +1981,24 @@ static CURLcode expect100(struct SessionHandle *data,
send_buffer *req_buffer)
{
CURLcode result = CURLE_OK;
+ const char *ptr;
data->state.expect100header = FALSE; /* default to false unless it is set
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:
- 100-continue to the headers which actually speeds up post
- operations (as there is one packet coming back from the web
- server) */
- result = add_bufferf(req_buffer,
- "Expect: 100-continue\r\n");
- if(result == CURLE_OK)
- data->state.expect100header = TRUE;
+ 100-continue to the headers which actually speeds up post operations
+ (as there is one packet coming back from the web server) */
+ ptr = checkheaders(data, "Expect:");
+ if (ptr) {
+ data->state.expect100header =
+ Curl_compareheader(ptr, "Expect:", "100-continue");
+ }
+ else {
+ result = add_bufferf(req_buffer,
+ "Expect: 100-continue\r\n");
+ if(result == CURLE_OK)
+ data->state.expect100header = TRUE;
+ }
}
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
sure that the expect100header is always set to the preferred value
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);
if(result)
return result;