http: don't send 100-continue for short PUT requests
This is already how curl is documented to behave in Everything curl, but in actuality only short POSTs skip this. This should knock 30 seconds off a full run of the test suite since the 100-continue timeout will no longer be hit. Closes #10740
This commit is contained in:
parent
970330bded
commit
ee521a1c88
9
docs/FAQ
9
docs/FAQ
@ -990,11 +990,10 @@ FAQ
|
||||
|
||||
4.16 My HTTP POST or PUT requests are slow
|
||||
|
||||
libcurl makes all POST and PUT requests (except for POST requests with a
|
||||
tiny request body) use the "Expect: 100-continue" header. This header
|
||||
allows the server to deny the operation early so that libcurl can bail out
|
||||
before having to send any data. This is useful in authentication
|
||||
cases and others.
|
||||
libcurl makes all POST and PUT requests (except for requests with a small
|
||||
request body) use the "Expect: 100-continue" header. This header allows the
|
||||
server to deny the operation early so that libcurl can bail out before having
|
||||
to send any data. This is useful in authentication cases and others.
|
||||
|
||||
However, many servers do not implement the Expect: stuff properly and if the
|
||||
server does not respond (positively) within 1 second libcurl will continue
|
||||
|
||||
11
lib/http.c
11
lib/http.c
@ -2340,7 +2340,16 @@ CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn,
|
||||
return result;
|
||||
}
|
||||
|
||||
if(http->postsize) {
|
||||
/* For really small puts we don't use Expect: headers at all, and for
|
||||
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. */
|
||||
ptr = Curl_checkheaders(data, STRCONST("Expect"));
|
||||
if(ptr) {
|
||||
data->state.expect100header =
|
||||
Curl_compareheader(ptr, STRCONST("Expect:"), STRCONST("100-continue"));
|
||||
}
|
||||
else if(http->postsize > EXPECT_100_THRESHOLD || http->postsize < 0) {
|
||||
result = expect100(data, conn, r);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
@ -49,7 +49,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 78
|
||||
Expect: 100-continue
|
||||
|
||||
Weird
|
||||
file
|
||||
|
||||
@ -98,7 +98,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
</protocol>
|
||||
|
||||
@ -97,7 +97,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
GET http://%HOSTIP:%HTTPPORT/%TESTNUMBER.upload2 HTTP/1.1
|
||||
@ -116,7 +115,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
</protocol>
|
||||
|
||||
@ -85,7 +85,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
@ -97,7 +96,6 @@ Authorization: Digest username="testuser", realm="gimme all yer s3cr3ts", nonce=
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
@ -59,7 +59,6 @@ Content-Range: bytes 0-99/100
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 100
|
||||
Expect: 100-continue
|
||||
|
||||
012345678
|
||||
012345678
|
||||
|
||||
@ -85,7 +85,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 78
|
||||
Expect: 100-continue
|
||||
|
||||
Weird
|
||||
file
|
||||
@ -101,7 +100,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 78
|
||||
Expect: 100-continue
|
||||
|
||||
Weird
|
||||
file
|
||||
|
||||
@ -60,7 +60,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 78
|
||||
Expect: 100-continue
|
||||
|
||||
Weird
|
||||
file
|
||||
|
||||
@ -91,7 +91,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
@ -70,7 +70,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
@ -82,7 +81,6 @@ Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
@ -51,7 +51,7 @@ http
|
||||
HTTP PUT expect 100-continue with a 400
|
||||
</name>
|
||||
<command option="no-output">
|
||||
-T log/file%TESTNUMBER http://%HOSTIP:%HTTPPORT/%TESTNUMBER -T log/file%TESTNUMBER http://%HOSTIP:%HTTPPORT/%TESTNUMBER0001
|
||||
-H "Expect: 100-continue" -T log/file%TESTNUMBER http://%HOSTIP:%HTTPPORT/%TESTNUMBER -T log/file%TESTNUMBER http://%HOSTIP:%HTTPPORT/%TESTNUMBER0001
|
||||
</command>
|
||||
</client>
|
||||
|
||||
@ -79,15 +79,15 @@ PUT /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 100
|
||||
Expect: 100-continue
|
||||
Content-Length: 100
|
||||
|
||||
PUT /%TESTNUMBER0001 HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 100
|
||||
Expect: 100-continue
|
||||
Content-Length: 100
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
|
||||
@ -85,7 +85,6 @@ Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", u
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
@ -61,7 +61,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 4
|
||||
Expect: 100-continue
|
||||
|
||||
moo
|
||||
GET /blah/moo.html&testcase=/%TESTNUMBER0002 HTTP/1.1
|
||||
|
||||
@ -71,7 +71,6 @@ Host: the.old.moo.%TESTNUMBER:%HTTPPORT
|
||||
Accept: */*
|
||||
User-Agent: Http Agent
|
||||
Content-Length: 13
|
||||
Expect: 100-continue
|
||||
|
||||
Hello Cloud!
|
||||
</protocol>
|
||||
|
||||
@ -73,7 +73,6 @@ Host: the.old.moo.%TESTNUMBER:%HTTPPORT
|
||||
Accept: */*
|
||||
User-Agent: Http Agent
|
||||
Content-Length: 13
|
||||
Expect: 100-continue
|
||||
|
||||
Hello Cloud!
|
||||
</protocol>
|
||||
|
||||
@ -10,9 +10,6 @@ HTTP Digest auth
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<servercmd>
|
||||
auth_required
|
||||
</servercmd>
|
||||
<data>
|
||||
HTTP/1.1 401 Authorization Required swsclose
|
||||
Server: Apache/1.3.27 (Darwin) PHP/4.1.2
|
||||
@ -88,15 +85,17 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
line three
|
||||
four is the number of lines
|
||||
PUT /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Authorization: Digest username="testuser", realm="gimme all yer s3cr3ts", nonce="11223344", uri="/%TESTNUMBER", response="b71551e12d1c456e47d8388ecb2edeca"
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
@ -10,9 +10,6 @@ NTLM
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<servercmd>
|
||||
auth_required
|
||||
</servercmd>
|
||||
<data>
|
||||
HTTP/1.1 401 NTLM Authorization Required swsclose
|
||||
Server: Apache/1.3.27 (Darwin) PHP/4.1.2
|
||||
@ -105,8 +102,11 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
line three
|
||||
four is the number of lines
|
||||
PUT /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
|
||||
@ -120,7 +120,6 @@ Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAL
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
@ -46,7 +46,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
@ -58,7 +58,6 @@ PUT /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
Content-Length: 22
|
||||
Expect: 100-continue
|
||||
|
||||
This is test PUT data
|
||||
POST /1948 HTTP/1.1
|
||||
|
||||
@ -98,7 +98,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
</protocol>
|
||||
|
||||
@ -98,7 +98,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
</protocol>
|
||||
|
||||
@ -98,7 +98,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 3
|
||||
Expect: 100-continue
|
||||
|
||||
st
|
||||
</protocol>
|
||||
|
||||
@ -58,7 +58,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
Content-Length: 78
|
||||
Expect: 100-continue
|
||||
|
||||
Weird
|
||||
file
|
||||
|
||||
@ -45,7 +45,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Transfer-Encoding: chunked
|
||||
Expect: 100-continue
|
||||
|
||||
%if hyper
|
||||
1E
|
||||
|
||||
@ -49,7 +49,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 38
|
||||
Expect: 100-continue
|
||||
|
||||
Weird
|
||||
file
|
||||
|
||||
@ -49,7 +49,6 @@ Content-Range: bytes 50-99/100
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 50
|
||||
Expect: 100-continue
|
||||
|
||||
012345678
|
||||
012345678
|
||||
|
||||
@ -53,16 +53,9 @@ HTTP PUT with Expect: 100-continue and 417 response
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -T log/test%TESTNUMBER.txt
|
||||
</command>
|
||||
# 1053700 x 'x', large enough to invoke the 100-continue behaviour
|
||||
<file name="log/test%TESTNUMBER.txt">
|
||||
Weird
|
||||
file
|
||||
to
|
||||
upload
|
||||
for
|
||||
testing
|
||||
the
|
||||
PUT
|
||||
feature
|
||||
%repeat[1053700 x x]%
|
||||
</file>
|
||||
</client>
|
||||
|
||||
@ -73,24 +66,16 @@ PUT /we/want/%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 78
|
||||
Content-Length: 1053701
|
||||
Expect: 100-continue
|
||||
|
||||
PUT /we/want/%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 78
|
||||
Content-Length: 1053701
|
||||
|
||||
Weird
|
||||
file
|
||||
to
|
||||
upload
|
||||
for
|
||||
testing
|
||||
the
|
||||
PUT
|
||||
feature
|
||||
%repeat[1053700 x x]%
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
||||
@ -43,7 +43,6 @@ Host: %HOSTIP:%HTTPSPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 1201
|
||||
Expect: 100-continue
|
||||
|
||||
%repeat[200 x banana]%
|
||||
</protocol>
|
||||
|
||||
@ -51,7 +51,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 10
|
||||
Expect: 100-continue
|
||||
|
||||
surprise!
|
||||
PUT /%TESTNUMBER HTTP/1.1
|
||||
@ -59,7 +58,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 10
|
||||
Expect: 100-continue
|
||||
|
||||
surprise!
|
||||
</protocol>
|
||||
|
||||
@ -51,7 +51,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 10
|
||||
Expect: 100-continue
|
||||
|
||||
surprise!
|
||||
</protocol>
|
||||
|
||||
@ -55,7 +55,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Testno: %TESTNUMBER
|
||||
Content-Length: 19
|
||||
Expect: 100-continue
|
||||
|
||||
first %TESTNUMBER contents
|
||||
PUT /two/first%TESTNUMBER HTTP/1.1
|
||||
@ -64,7 +63,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Testno: %TESTNUMBER
|
||||
Content-Length: 19
|
||||
Expect: 100-continue
|
||||
|
||||
first %TESTNUMBER contents
|
||||
PUT /one/second%TESTNUMBER HTTP/1.1
|
||||
@ -73,7 +71,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Testno: %TESTNUMBER
|
||||
Content-Length: 20
|
||||
Expect: 100-continue
|
||||
|
||||
second %TESTNUMBER contents
|
||||
PUT /two/second%TESTNUMBER HTTP/1.1
|
||||
@ -82,7 +79,6 @@ User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Testno: %TESTNUMBER
|
||||
Content-Length: 20
|
||||
Expect: 100-continue
|
||||
|
||||
second %TESTNUMBER contents
|
||||
</protocol>
|
||||
|
||||
@ -41,7 +41,6 @@ Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 12
|
||||
Expect: 100-continue
|
||||
|
||||
a few bytes
|
||||
</protocol>
|
||||
|
||||
@ -88,7 +88,6 @@ Authorization: Digest username="testuser", realm="testrealm", nonce="1053604145"
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
Content-Length: 85
|
||||
Expect: 100-continue
|
||||
|
||||
This is data we upload with PUT
|
||||
a second line
|
||||
|
||||
Loading…
Reference in New Issue
Block a user