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

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
This commit is contained in:
Daniel Stenberg 2014-04-04 14:50:18 +02:00
parent c81021f747
commit 42937f87e6
7 changed files with 66 additions and 8 deletions

View File

@ -2395,9 +2395,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
return result; return result;
} }
result = expect100(data, conn, req_buffer); if(postsize != 0) {
if(result) result = expect100(data, conn, req_buffer);
return result; if(result)
return result;
}
result = Curl_add_buffer(req_buffer, "\r\n", 2); /* end of headers */ result = Curl_add_buffer(req_buffer, "\r\n", 2); /* end of headers */
if(result) if(result)

View File

@ -120,7 +120,7 @@ test1388 test1389 test1390 test1391 test1392 test1393 test1394 test1395 \
test1396 test1397 \ test1396 test1397 \
\ \
test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \ 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 \ test1416 test1417 test1418 test1419 \
\ \
test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \ test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \

View File

@ -90,7 +90,6 @@ Host: %HOSTIP:%HTTPPORT
Accept: */* Accept: */*
Proxy-Connection: Keep-Alive Proxy-Connection: Keep-Alive
Content-Length: 0 Content-Length: 0
Expect: 100-continue
GET http://%HOSTIP:%HTTPPORT/1001 HTTP/1.1 GET http://%HOSTIP:%HTTPPORT/1001 HTTP/1.1
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1001", response="6af4d89c952f4dd4cc215a6878dc499d" Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1001", response="6af4d89c952f4dd4cc215a6878dc499d"

View File

@ -89,7 +89,6 @@ Host: %HOSTIP:%HTTPPORT
Accept: */* Accept: */*
Proxy-Connection: Keep-Alive Proxy-Connection: Keep-Alive
Content-Length: 0 Content-Length: 0
Expect: 100-continue
GET http://%HOSTIP:%HTTPPORT/1002.upload1 HTTP/1.1 GET http://%HOSTIP:%HTTPPORT/1002.upload1 HTTP/1.1
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1002.upload1", response="198aa9b6acb4b0c71d02a197a5e41f54" Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1002.upload1", response="198aa9b6acb4b0c71d02a197a5e41f54"

60
tests/data/test1411 Normal file
View File

@ -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>

View File

@ -121,7 +121,6 @@ Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
Host: %HOSTIP:%HTTPPORT Host: %HOSTIP:%HTTPPORT
Accept: */* Accept: */*
Content-Length: 0 Content-Length: 0
Expect: 100-continue
PUT /155 HTTP/1.1 PUT /155 HTTP/1.1
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAFuu0VIvKeMdPwjDPk7eAnwxMjM0NTY3OC1uDhL9DbZXt27JqdXMDkABAQAAAAAAAACAPtXesZ0BMTIzNDU2NzgAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA== Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAFuu0VIvKeMdPwjDPk7eAnwxMjM0NTY3OC1uDhL9DbZXt27JqdXMDkABAQAAAAAAAACAPtXesZ0BMTIzNDU2NzgAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==

View File

@ -82,7 +82,6 @@ PUT /88 HTTP/1.1
Host: %HOSTIP:%HTTPPORT Host: %HOSTIP:%HTTPPORT
Accept: */* Accept: */*
Content-Length: 0 Content-Length: 0
Expect: 100-continue
PUT /88 HTTP/1.1 PUT /88 HTTP/1.1
Authorization: Digest username="testuser", realm="testrealm", nonce="1053604145", uri="/88", response="78a49fa53d0c228778297687d4168e71" Authorization: Digest username="testuser", realm="testrealm", nonce="1053604145", uri="/88", response="78a49fa53d0c228778297687d4168e71"