mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Toshiyuki Maezawa reported that when doing a POST with a read callback,
libcurl didn't properly send an Expect: 100-continue header. It does now.
This commit is contained in:
parent
6a27449922
commit
c904b6b5bf
8
CHANGES
8
CHANGES
@ -6,6 +6,14 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Daniel (18 April 2005)
|
||||||
|
- Toshiyuki Maezawa reported that when doing a POST with a read callback,
|
||||||
|
libcurl didn't properly send an Expect: 100-continue header. It does now.
|
||||||
|
|
||||||
|
- I committed by mig change in the test suite's FTP server that moves out all
|
||||||
|
socket/TCP code to a separate C program named sockfilt. And added 4 new
|
||||||
|
test cases for FTP over IPv6.
|
||||||
|
|
||||||
Daniel (8 April 2005)
|
Daniel (8 April 2005)
|
||||||
- Cory Nelson reported a problem with a HTTP server that responded with a 304
|
- Cory Nelson reported a problem with a HTTP server that responded with a 304
|
||||||
response containing an "illegal" Content-Length: header, which was not
|
response containing an "illegal" Content-Length: header, which was not
|
||||||
|
68
lib/http.c
68
lib/http.c
@ -1347,6 +1347,27 @@ CURLcode Curl_http_done(struct connectdata *conn,
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check and possibly add an Expect: header */
|
||||||
|
static CURLcode expect100(struct SessionHandle *data,
|
||||||
|
send_buffer *req_buffer)
|
||||||
|
{
|
||||||
|
CURLcode result = CURLE_OK;
|
||||||
|
if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
|
||||||
|
!checkheaders(data, "Expect:")) {
|
||||||
|
/* 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->set.expect100header = TRUE;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Curl_http() gets called from the generic Curl_do() function when a HTTP
|
* Curl_http() gets called from the generic Curl_do() function when a HTTP
|
||||||
* request is to be performed. This creates and sends a properly constructed
|
* request is to be performed. This creates and sends a properly constructed
|
||||||
@ -1928,18 +1949,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
|
result = expect100(data, req_buffer);
|
||||||
!checkheaders(data, "Expect:")) {
|
if(result)
|
||||||
/* if not doing HTTP 1.0 or disabled explicitly, we add a Expect:
|
return result;
|
||||||
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)
|
|
||||||
return result;
|
|
||||||
data->set.expect100header = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!checkheaders(data, "Content-Type:")) {
|
if(!checkheaders(data, "Content-Type:")) {
|
||||||
/* Get Content-Type: line from Curl_formpostheader.
|
/* Get Content-Type: line from Curl_formpostheader.
|
||||||
@ -2002,18 +2014,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
|
result = expect100(data, req_buffer);
|
||||||
!checkheaders(data, "Expect:")) {
|
if(result)
|
||||||
/* if not HTTP 1.0 or disabled explicitly, we add a Expect:
|
return result;
|
||||||
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)
|
|
||||||
return result;
|
|
||||||
data->set.expect100header = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = add_buffer(req_buffer, "\r\n", 2); /* end of headers */
|
result = add_buffer(req_buffer, "\r\n", 2); /* end of headers */
|
||||||
if(result)
|
if(result)
|
||||||
@ -2121,21 +2124,18 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
/* set the upload size to the progress meter */
|
/* set the upload size to the progress meter */
|
||||||
Curl_pgrsSetUploadSize(data, http->postsize);
|
Curl_pgrsSetUploadSize(data, http->postsize);
|
||||||
|
|
||||||
if((data->set.httpversion != CURL_HTTP_VERSION_1_0) &&
|
result = expect100(data, req_buffer);
|
||||||
!checkheaders(data, "Expect:")) {
|
if(result)
|
||||||
/* if not HTTP 1.0 or disabled explicitly, we add a Expect:
|
return result;
|
||||||
100-continue to the headers which actually speeds up post
|
|
||||||
operations (as there is one packet coming back from the web
|
|
||||||
server) */
|
|
||||||
add_bufferf(req_buffer,
|
|
||||||
"Expect: 100-continue\r\n");
|
|
||||||
data->set.expect100header = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
|
add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
result = expect100(data, req_buffer);
|
||||||
|
if(result)
|
||||||
|
return result;
|
||||||
|
|
||||||
add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
|
add_buffer(req_buffer, "\r\n", 2); /* end of headers! */
|
||||||
|
|
||||||
if(data->set.postfieldsize) {
|
if(data->set.postfieldsize) {
|
||||||
|
@ -40,6 +40,7 @@ Pragma: no-cache
|
|||||||
Accept: */*
|
Accept: */*
|
||||||
Content-Length: 45
|
Content-Length: 45
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
Expect: 100-continue
|
||||||
|
|
||||||
this is what we post to the silly web server
|
this is what we post to the silly web server
|
||||||
</protocol>
|
</protocol>
|
||||||
|
@ -40,6 +40,7 @@ Pragma: no-cache
|
|||||||
Accept: */*
|
Accept: */*
|
||||||
Transfer-Encoding: chunked
|
Transfer-Encoding: chunked
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
Expect: 100-continue
|
||||||
|
|
||||||
3
|
3
|
||||||
one
|
one
|
||||||
|
@ -31,6 +31,7 @@ Pragma: no-cache
|
|||||||
Accept: */*
|
Accept: */*
|
||||||
Content-Length: 1
|
Content-Length: 1
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
Expect: 100-continue
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
# 42 - aborted by callback
|
# 42 - aborted by callback
|
||||||
|
@ -41,6 +41,7 @@ Pragma: no-cache
|
|||||||
Accept: */*
|
Accept: */*
|
||||||
Content-Length: 0
|
Content-Length: 0
|
||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
|
Expect: 100-continue
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
</verify>
|
</verify>
|
||||||
|
Loading…
Reference in New Issue
Block a user