1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 07:38:49 -05:00

getting only a 100 Continue response and nothing else, when talking HTTP,

is now treated as an error by libcurl
This commit is contained in:
Daniel Stenberg 2004-04-07 14:27:54 +00:00
parent 348fe0e210
commit 72b1144b8c
9 changed files with 102 additions and 38 deletions

View File

@ -6,6 +6,13 @@
Changelog 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) Daniel (6 April 2004)
- Gisle Vanem's fixed bug #927979 reported by Nathan O'Sullivan. The problem - 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 made libcurl on Windows leak a small amount of memory in each name resolve

13
README
View File

@ -34,6 +34,7 @@ WEB SITE
Australia -- http://curl.planetmirror.com/ Australia -- http://curl.planetmirror.com/
Estonia -- http://curl.dope-brothers.com/ Estonia -- http://curl.dope-brothers.com/
Germany -- http://curl.mirror.at.stealer.net/ Germany -- http://curl.mirror.at.stealer.net/
Germany -- http://curl.netmirror.org/
Russia -- http://curl.tsuren.net/ Russia -- http://curl.tsuren.net/
Thailand -- http://curl.siamu.ac.th/ Thailand -- http://curl.siamu.ac.th/
US (CA) -- http://curl.mirror.redwire.net/ US (CA) -- http://curl.mirror.redwire.net/
@ -42,15 +43,17 @@ DOWNLOAD
The official download mirror sites are: The official download mirror sites are:
Australia -- http://curl.planetmirror.com/download/ Australia -- http://curl.planetmirror.com/download.html
Estonia -- http://curl.dope-brothers.com/download/ Estonia -- http://curl.dope-brothers.com/download.html
Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/ 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/ 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 -- ftp://ftp.sunet.se/pub/www/utilities/curl/
Sweden -- http://cool.haxx.se/curl/ Sweden -- http://cool.haxx.se/curl/
Thailand -- http://curl.siamu.ac.th/download/ Thailand -- http://curl.siamu.ac.th/download.html
US (CA) -- http://curl.mirror.redwire.net/download/ US (CA) -- http://curl.mirror.redwire.net/download.html
CVS CVS

View File

@ -13,9 +13,12 @@ This release includes the following changes:
This release includes the following bugfixes: 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 fixed minor memory leak in libcurl for Windows when staticly linked
o POST/PUT using Digest/NTLM/Negotiate (including anyauth) now work better 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 curl_strnqual.3 "refer-to" man page fix
o fixed a minor very old progress meter final update bug o fixed a minor very old progress meter final update bug
o added checks for a working NI_WITHSCOPEID before that is used 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: Other curl-related news since the previous public release:
o PycURL 7.11.1 was released: http://pycurl.sf.net/ 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 This release would not have looked like this without help, code, reports and
advice from friends like these: advice from friends like these:

View File

@ -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 indicate that the user wants to reach the root dir (this exception SHALL
remain even when this bug is fixed). 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 * libcurl doesn't treat the content-length of compressed data properly, as
it seems HTTP servers send the *uncompressed* length in that header and it seems HTTP servers send the *uncompressed* length in that header and
libcurl thinks of it as the *compressed* lenght. Some explanations are here: libcurl thinks of it as the *compressed* lenght. Some explanations are here:

View File

@ -1116,10 +1116,12 @@ CURLcode Curl_http_done(struct connectdata *conn)
conn->bytecount = http->readbytecount + http->writebytecount; conn->bytecount = http->readbytecount + http->writebytecount;
if(!conn->bits.retry && 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 /* 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 read from the HTTP server (that counts), this can't be right so we
here */ return an error here */
failf(data, "Empty reply from server"); failf(data, "Empty reply from server");
return CURLE_GOT_NOTHING; return CURLE_GOT_NOTHING;
} }

View File

@ -468,6 +468,9 @@ CURLcode Curl_readwrite(struct connectdata *conn,
data->info.header_size += headerlen; data->info.header_size += headerlen;
conn->headerbytecount += headerlen; conn->headerbytecount += headerlen;
conn->deductheadercount =
(100 == k->httpcode)?conn->headerbytecount:0;
if (conn->resume_from && if (conn->resume_from &&
!k->content_range && !k->content_range &&
(data->set.httpreq==HTTPREQ_GET)) { (data->set.httpreq==HTTPREQ_GET)) {

View File

@ -438,6 +438,11 @@ struct connectdata {
char *ppath; char *ppath;
curl_off_t bytecount; curl_off_t bytecount;
long headerbytecount; /* only count received headers */ 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 char *range; /* range, if used. See README for detailed specification on
this syntax. */ this syntax. */

View File

@ -2,28 +2,26 @@ iall:
install: install:
test: test:
EXTRA_DIST = \ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test1 test108 test117 test127 test20 test27 test34 test46 \ test10 test109 test118 test13 test200 test28 test36 test47 test100 \
test10 test109 test118 test13 test200 test28 test36 test47 \ test11 test119 test14 test201 test29 test37 test5 test101 test110 \
test100 test11 test119 test14 test201 test29 test37 test5 \ test12 test15 test202 test3 test4 test6 test102 test111 test120 test16 \
test101 test110 test12 test15 test202 test3 test4 test6 \ test21 test30 test7 test103 test112 test121 test17 test22 test300 \
test102 test111 test120 test16 test21 test30 test7 \ test8 test104 test113 test122 test18 test23 test301 test9 test105 \
test103 test112 test121 test17 test22 test300 test8 \ test114 test123 test19 test24 test302 test43 test31 test106 test115 \
test104 test113 test122 test18 test23 test301 test9 \ test124 test190 test25 test303 test44 test38 test107 test116 test125 \
test105 test114 test123 test19 test24 test302 test43 test31 \ test2 test26 test33 test45 test126 test304 test39 test32 test128 \
test106 test115 test124 test190 test25 test303 test44 test38 \ test48 test306 test130 test131 test132 test133 test134 test135 test305 \
test107 test116 test125 test2 test26 test33 test45 test126 \ test49 test50 test51 test52 test53 test54 test55 test56 test500 \
test304 test39 test32 test128 test48 test306 \ test501 test502 test503 test504 test136 test57 test137 test138 test58 \
test130 test131 test132 test133 test134 test135 test305 \ test139 test140 test141 test59 test60 test61 test142 test143 test62 \
test49 test50 test51 test52 test53 test54 test55 test56 \ test63 test64 test65 test66 test144 test145 test67 test68 test41 \
test500 test501 test502 test503 test504 test136 test57 test137 test138 \ test40 test42 test69 test70 test71 test72 test73 test146 test505 \
test58 test139 test140 test141 test59 test60 test61 test142 test143 \ test74 test75 test76 test77 test78 test147 test148 test506 test79 \
test62 test63 test64 test65 test66 test144 test145 test67 test68 test41 \ test80 test81 test82 test83 test84 test85 test86 test87 test507 \
test40 test42 test69 test70 test71 test72 test73 test146 test505 \ test149 test88 test89 test90 test508 test91 test92 test203 test93 \
test74 test75 test76 test77 test78 test147 test148 test506 test79 test80 \ test94 test95 test509 test510 test97 test98 test99 test150 test151 \
test81 test82 test83 test84 test85 test86 test87 test507 test149 test88 \ test152 test153 test154 test155 test156 test157 test158
test89 test90 test508 test91 test92 test203 test93 test94 test95 test509 \
test510 test97 test98 test99 test150 test151 test152 test153
# The following tests have been removed from the dist since they no longer # 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 # work. We need to fix the test suite's FTPS server first, then bring them

49
tests/data/test158 Normal file
View File

@ -0,0 +1,49 @@
# Server-side
<reply>
<data>
HTTP/1.1 100 Continue swsclose
Silly-header: yeeeees
</data>
</reply>
# Client-side
<client>
<server>
http
</server>
<name>
HTTP multipart formpost with only a 100 reply
</name>
<command>
http://%HOSTIP:%HOSTPORT/158 -F name=daniel
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
^Content-Type: multipart/form-data.*
^---------------------------.*
</strip>
<protocol>
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--
</protocol>
<errorcode>
52
</errorcode>
</verify>