aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-06-02 14:57:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-06-02 14:57:08 +0000
commit06984df5cb603ee6942d283c649215cda7c3160f (patch)
tree43e96ad6dadfcdf3c55accb33504e48172c5ca71
parent4f136a3a76c437e8ceacd697ea69e488178ca44a (diff)
Make the Content-Length info override the Connection: close header, so that
libcurl will stop reading when the number of bytes have arrived and not wait for a closed socket.
-rw-r--r--lib/transfer.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index f58db35bf..6571e1636 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -457,11 +457,16 @@ CURLcode Curl_readwrite(struct connectdata *conn,
*/
if(data->set.no_body)
stop_reading = TRUE;
- else if(!conn->bits.close) {
- /* If this is not the last request before a close, we must
- set the maximum download size to the size of the
- expected document or else, we won't know when to stop
- reading! */
+ else {
+ /* If we know the expected size of this document, we set the
+ maximum download size to the size of the expected
+ document or else, we won't know when to stop reading!
+
+ Note that we set the download maximum even if we read a
+ "Connection: close" header, to make sure that
+ "Content-Length: 0" still prevents us from attempting to
+ read the (missing) response-body.
+ */
if(-1 != conn->size)
conn->maxdownload = conn->size;
}