diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-04-04 14:50:18 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-04-04 15:46:35 +0200 |
commit | 42937f87e65554ec4b887a5bd0b34abdbf2e0977 (patch) | |
tree | 30f1ac7aa9b7aac7c1cced638570637f5939223b | |
parent | c81021f74796a391be739665fec64431a66325c4 (diff) |
HTTP: don't send Content-Length: 0 _and_ Expect: 100-continue
Without request body there's no point in asking for 100-continue.
Bug: http://curl.haxx.se/bug/view.cgi?id=1349
Reported-by: JimS
-rw-r--r-- | lib/http.c | 8 | ||||
-rw-r--r-- | tests/data/Makefile.am | 2 | ||||
-rw-r--r-- | tests/data/test1001 | 1 | ||||
-rw-r--r-- | tests/data/test1002 | 1 | ||||
-rw-r--r-- | tests/data/test1411 | 60 | ||||
-rw-r--r-- | tests/data/test155 | 1 | ||||
-rw-r--r-- | tests/data/test88 | 1 |
7 files changed, 66 insertions, 8 deletions
diff --git a/lib/http.c b/lib/http.c index 789ee8fa9..f803e58f8 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2395,9 +2395,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) return result; } - result = expect100(data, conn, req_buffer); - if(result) - return result; + if(postsize != 0) { + result = expect100(data, conn, req_buffer); + if(result) + return result; + } result = Curl_add_buffer(req_buffer, "\r\n", 2); /* end of headers */ if(result) diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 9a8ee5680..5c520c4f6 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -120,7 +120,7 @@ test1388 test1389 test1390 test1391 test1392 test1393 test1394 test1395 \ test1396 test1397 \ \ test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \ -test1408 test1409 test1410 test1412 test1413 test1414 test1415 \ +test1408 test1409 test1410 test1411 test1412 test1413 test1414 test1415 \ test1416 test1417 test1418 test1419 \ \ test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \ diff --git a/tests/data/test1001 b/tests/data/test1001 index aabbec916..529e77033 100644 --- a/tests/data/test1001 +++ b/tests/data/test1001 @@ -90,7 +90,6 @@ Host: %HOSTIP:%HTTPPORT Accept: */*
Proxy-Connection: Keep-Alive
Content-Length: 0
-Expect: 100-continue
GET http://%HOSTIP:%HTTPPORT/1001 HTTP/1.1
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1001", response="6af4d89c952f4dd4cc215a6878dc499d"
diff --git a/tests/data/test1002 b/tests/data/test1002 index 829444ce0..c2b811fe0 100644 --- a/tests/data/test1002 +++ b/tests/data/test1002 @@ -89,7 +89,6 @@ Host: %HOSTIP:%HTTPPORT Accept: */*
Proxy-Connection: Keep-Alive
Content-Length: 0
-Expect: 100-continue
GET http://%HOSTIP:%HTTPPORT/1002.upload1 HTTP/1.1
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1002.upload1", response="198aa9b6acb4b0c71d02a197a5e41f54"
diff --git a/tests/data/test1411 b/tests/data/test1411 new file mode 100644 index 000000000..3ffd586de --- /dev/null +++ b/tests/data/test1411 @@ -0,0 +1,60 @@ +<testcase> +<info> +<keywords> +HTTP +PUT +</keywords> +</info> + +<reply> +<data> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT +ETag: "21025-dc7-39462498" +Accept-Ranges: bytes +Content-Length: 6 +Connection: close +Content-Type: text/html +Funny-head: yesyes + +-foo- +</data> +</reply> + + +# +# Client-side +<client> +<server> +http +</server> + +# make sure there's no Expect: 100-continue when there's no file to send! + <name> +HTTP with zero size file PUT + </name> + <command> +http://%HOSTIP:%HTTPPORT/1411 -T log/empty1411 +</command> +# create an empty file +<file name="log/empty1411"> +</file> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +PUT /1411 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Content-Length: 0
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test155 b/tests/data/test155 index 8f765331a..0a2a99938 100644 --- a/tests/data/test155 +++ b/tests/data/test155 @@ -121,7 +121,6 @@ Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA= Host: %HOSTIP:%HTTPPORT
Accept: */*
Content-Length: 0
-Expect: 100-continue
PUT /155 HTTP/1.1
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAFuu0VIvKeMdPwjDPk7eAnwxMjM0NTY3OC1uDhL9DbZXt27JqdXMDkABAQAAAAAAAACAPtXesZ0BMTIzNDU2NzgAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
diff --git a/tests/data/test88 b/tests/data/test88 index 2495aecfe..878b7db1b 100644 --- a/tests/data/test88 +++ b/tests/data/test88 @@ -82,7 +82,6 @@ PUT /88 HTTP/1.1 Host: %HOSTIP:%HTTPPORT
Accept: */*
Content-Length: 0
-Expect: 100-continue
PUT /88 HTTP/1.1
Authorization: Digest username="testuser", realm="testrealm", nonce="1053604145", uri="/88", response="78a49fa53d0c228778297687d4168e71"
|