From 72b1144b8c1844ec81d5f5b73eb9b2a088377fec Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 7 Apr 2004 14:27:54 +0000 Subject: getting only a 100 Continue response and nothing else, when talking HTTP, is now treated as an error by libcurl --- CHANGES | 7 +++++++ README | 13 ++++++++----- RELEASE-NOTES | 6 +++++- docs/KNOWN_BUGS | 7 ------- lib/http.c | 8 +++++--- lib/transfer.c | 3 +++ lib/urldata.h | 5 +++++ tests/data/Makefile.am | 42 ++++++++++++++++++++---------------------- tests/data/test158 | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 tests/data/test158 diff --git a/CHANGES b/CHANGES index df2d8eaec..c93fcccc7 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,13 @@ Changelog +Daniel (7 April 2004) +- A request that sends "Expect: 100-continue" and gets nothing but a single + 100 response back will now return a CURLE_GOT_NOTHING. Test 158 verifies. + +- The strtoofft() macro is now named curlx_strtoofft() to use the curlx_* + approach fully. + Daniel (6 April 2004) - Gisle Vanem's fixed bug #927979 reported by Nathan O'Sullivan. The problem made libcurl on Windows leak a small amount of memory in each name resolve diff --git a/README b/README index bbd447c91..22b18b22a 100644 --- a/README +++ b/README @@ -34,6 +34,7 @@ WEB SITE Australia -- http://curl.planetmirror.com/ Estonia -- http://curl.dope-brothers.com/ Germany -- http://curl.mirror.at.stealer.net/ + Germany -- http://curl.netmirror.org/ Russia -- http://curl.tsuren.net/ Thailand -- http://curl.siamu.ac.th/ US (CA) -- http://curl.mirror.redwire.net/ @@ -42,15 +43,17 @@ DOWNLOAD The official download mirror sites are: - Australia -- http://curl.planetmirror.com/download/ - Estonia -- http://curl.dope-brothers.com/download/ + Australia -- http://curl.planetmirror.com/download.html + Estonia -- http://curl.dope-brothers.com/download.html Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/ + Germany -- http://curl.mirror.at.stealer.net/download.html + Germany -- http://curl.netmirror.org/download.html Hongkong -- http://www.execve.net/curl/ - Russia -- http://curl.tsuren.net/download/ + Russia -- http://curl.tsuren.net/download.html Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/ Sweden -- http://cool.haxx.se/curl/ - Thailand -- http://curl.siamu.ac.th/download/ - US (CA) -- http://curl.mirror.redwire.net/download/ + Thailand -- http://curl.siamu.ac.th/download.html + US (CA) -- http://curl.mirror.redwire.net/download.html CVS diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 089c5960f..a8c224524 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -13,9 +13,12 @@ This release includes the following changes: This release includes the following bugfixes: + o getting only a 100 Continue response and nothing else, when talking HTTP, + is now treated as an error by libcurl o fixed minor memory leak in libcurl for Windows when staticly linked o POST/PUT using Digest/NTLM/Negotiate (including anyauth) now work better - o --limit-rate with high speed rates is a lot more accurate now + o --limit-rate with high speed rates is a lot more accurate now, and supports + limiting to speeds >2GB/sec on systems with Large File support. o curl_strnqual.3 "refer-to" man page fix o fixed a minor very old progress meter final update bug o added checks for a working NI_WITHSCOPEID before that is used @@ -39,6 +42,7 @@ This release includes the following bugfixes: Other curl-related news since the previous public release: o PycURL 7.11.1 was released: http://pycurl.sf.net/ + o New German web mirror: http://curl.netmirror.org/ This release would not have looked like this without help, code, reports and advice from friends like these: diff --git a/docs/KNOWN_BUGS b/docs/KNOWN_BUGS index 6f60d4022..7726b225c 100644 --- a/docs/KNOWN_BUGS +++ b/docs/KNOWN_BUGS @@ -23,13 +23,6 @@ may have been fixed since this was written! indicate that the user wants to reach the root dir (this exception SHALL remain even when this bug is fixed). -* 1) libcurl does a POST - 2) receives a 100-continue - 3) sends away the POST - Now, if nothing else is returned from the server, libcurl MUST return - CURLE_GOT_NOTHING, but it seems it returns CURLE_OK as it seems to count - the 100-continue reply as a good enough reply. - * libcurl doesn't treat the content-length of compressed data properly, as it seems HTTP servers send the *uncompressed* length in that header and libcurl thinks of it as the *compressed* lenght. Some explanations are here: diff --git a/lib/http.c b/lib/http.c index 3c2eceff3..32666d82b 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1116,10 +1116,12 @@ CURLcode Curl_http_done(struct connectdata *conn) conn->bytecount = http->readbytecount + http->writebytecount; if(!conn->bits.retry && - !(http->readbytecount + conn->headerbytecount)) { + ((http->readbytecount + + conn->headerbytecount - + conn->deductheadercount)) <= 0) { /* If this connection isn't simply closed to be retried, AND nothing was - read from the HTTP server, this can't be right so we return an error - here */ + read from the HTTP server (that counts), this can't be right so we + return an error here */ failf(data, "Empty reply from server"); return CURLE_GOT_NOTHING; } diff --git a/lib/transfer.c b/lib/transfer.c index 4d5577a05..4385b843d 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -468,6 +468,9 @@ CURLcode Curl_readwrite(struct connectdata *conn, data->info.header_size += headerlen; conn->headerbytecount += headerlen; + conn->deductheadercount = + (100 == k->httpcode)?conn->headerbytecount:0; + if (conn->resume_from && !k->content_range && (data->set.httpreq==HTTPREQ_GET)) { diff --git a/lib/urldata.h b/lib/urldata.h index 4ed66243d..4f53d8412 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -438,6 +438,11 @@ struct connectdata { char *ppath; curl_off_t bytecount; long headerbytecount; /* only count received headers */ + long deductheadercount; /* this amount of bytes doesn't count when we check + if anything has been transfered at the end of + a connection. We use this counter to make only + a 100 reply (without a following second response + code) result in a CURLE_GOT_NOTHING error code */ char *range; /* range, if used. See README for detailed specification on this syntax. */ diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 46df9cb2f..cc260ab9f 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -2,28 +2,26 @@ iall: install: test: -EXTRA_DIST = \ -test1 test108 test117 test127 test20 test27 test34 test46 \ -test10 test109 test118 test13 test200 test28 test36 test47 \ -test100 test11 test119 test14 test201 test29 test37 test5 \ -test101 test110 test12 test15 test202 test3 test4 test6 \ -test102 test111 test120 test16 test21 test30 test7 \ -test103 test112 test121 test17 test22 test300 test8 \ -test104 test113 test122 test18 test23 test301 test9 \ -test105 test114 test123 test19 test24 test302 test43 test31 \ -test106 test115 test124 test190 test25 test303 test44 test38 \ -test107 test116 test125 test2 test26 test33 test45 test126 \ -test304 test39 test32 test128 test48 test306 \ -test130 test131 test132 test133 test134 test135 test305 \ -test49 test50 test51 test52 test53 test54 test55 test56 \ -test500 test501 test502 test503 test504 test136 test57 test137 test138 \ -test58 test139 test140 test141 test59 test60 test61 test142 test143 \ -test62 test63 test64 test65 test66 test144 test145 test67 test68 test41 \ -test40 test42 test69 test70 test71 test72 test73 test146 test505 \ -test74 test75 test76 test77 test78 test147 test148 test506 test79 test80 \ -test81 test82 test83 test84 test85 test86 test87 test507 test149 test88 \ -test89 test90 test508 test91 test92 test203 test93 test94 test95 test509 \ -test510 test97 test98 test99 test150 test151 test152 test153 +EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \ +test10 test109 test118 test13 test200 test28 test36 test47 test100 \ +test11 test119 test14 test201 test29 test37 test5 test101 test110 \ +test12 test15 test202 test3 test4 test6 test102 test111 test120 test16 \ +test21 test30 test7 test103 test112 test121 test17 test22 test300 \ +test8 test104 test113 test122 test18 test23 test301 test9 test105 \ +test114 test123 test19 test24 test302 test43 test31 test106 test115 \ +test124 test190 test25 test303 test44 test38 test107 test116 test125 \ +test2 test26 test33 test45 test126 test304 test39 test32 test128 \ +test48 test306 test130 test131 test132 test133 test134 test135 test305 \ +test49 test50 test51 test52 test53 test54 test55 test56 test500 \ +test501 test502 test503 test504 test136 test57 test137 test138 test58 \ +test139 test140 test141 test59 test60 test61 test142 test143 test62 \ +test63 test64 test65 test66 test144 test145 test67 test68 test41 \ +test40 test42 test69 test70 test71 test72 test73 test146 test505 \ +test74 test75 test76 test77 test78 test147 test148 test506 test79 \ +test80 test81 test82 test83 test84 test85 test86 test87 test507 \ +test149 test88 test89 test90 test508 test91 test92 test203 test93 \ +test94 test95 test509 test510 test97 test98 test99 test150 test151 \ +test152 test153 test154 test155 test156 test157 test158 # The following tests have been removed from the dist since they no longer # work. We need to fix the test suite's FTPS server first, then bring them diff --git a/tests/data/test158 b/tests/data/test158 new file mode 100644 index 000000000..95ad05978 --- /dev/null +++ b/tests/data/test158 @@ -0,0 +1,49 @@ +# Server-side + + +HTTP/1.1 100 Continue swsclose +Silly-header: yeeeees + + + + +# Client-side + + +http + + +HTTP multipart formpost with only a 100 reply + + +http://%HOSTIP:%HOSTPORT/158 -F name=daniel + + + +# Verify data after the test has been "shot" + + +^User-Agent:.* +^Content-Type: multipart/form-data.* +^---------------------------.* + + +POST /158 HTTP/1.1 +User-Agent: curl/7.11.2-CVS (i686-pc-linux-gnu) libcurl/7.11.2-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS +Host: 127.0.0.1:8999 +Pragma: no-cache +Accept: */* +Content-Length: 145 +Expect: 100-continue +Content-Type: multipart/form-data; boundary=----------------------------4f12fcdaa3bc + +------------------------------4f12fcdaa3bc +Content-Disposition: form-data; name="name" + +daniel +------------------------------4f12fcdaa3bc-- + + +52 + + -- cgit v1.2.3