Commit 42937f87 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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
parent c81021f7
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2395,9 +2395,11 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
        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)
+1 −1
Original line number Diff line number Diff line
@@ -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 \
+0 −1
Original line number Diff line number Diff line
@@ -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"
+0 −1
Original line number Diff line number Diff line
@@ -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"

tests/data/test1411

0 → 100644
+60 −0
Original line number Diff line number Diff line
<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>
Loading