]> granicus.if.org Git - curl/commitdiff
Make the Content-Length info override the Connection: close header, so that
authorDaniel Stenberg <daniel@haxx.se>
Mon, 2 Jun 2003 14:57:08 +0000 (14:57 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 Jun 2003 14:57:08 +0000 (14:57 +0000)
libcurl will stop reading when the number of bytes have arrived and not wait
for a closed socket.

lib/transfer.c

index f58db35bf53598a9327f9f1d2ab4bf99bca42052..6571e16369ede0a09e492dfb3bdfc49a52c4b35f 100644 (file)
@@ -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;
                 }