]> granicus.if.org Git - curl/commitdiff
Makes CURLINFO_CONTENT_LENGTH_DOWNLOAD work even if CURLOPT_NOBODY is set
authorDaniel Stenberg <daniel@haxx.se>
Mon, 22 Mar 2004 22:38:12 +0000 (22:38 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 22 Mar 2004 22:38:12 +0000 (22:38 +0000)
true.

lib/transfer.c

index 84d244ef03fed7a368873683d366f04b51631777..2a0df0f64c6d448243135047f5c555018bc8f7b5 100644 (file)
@@ -507,10 +507,14 @@ CURLcode Curl_readwrite(struct connectdata *conn,
                   if(conn->bits.chunk)
                     conn->size=-1;
 
-                  if(-1 != conn->size) {
-                    Curl_pgrsSetDownloadSize(data, conn->size);
-                    conn->maxdownload = conn->size;
-                  }
+                }
+                if(-1 != conn->size) {
+                  /* We do this operation even if no_body is true, since this
+                     data might be retrieved later with curl_easy_getinfo()
+                     and its CURLINFO_CONTENT_LENGTH_DOWNLOAD option. */
+
+                  Curl_pgrsSetDownloadSize(data, conn->size);
+                  conn->maxdownload = conn->size;
                 }
                 /* If max download size is *zero* (nothing) we already
                    have nothing and can safely return ok now! */