--- transfer.c.orig	2007-08-13 16:57:03.000000000 +0800
+++ transfer.c	2007-08-13 17:19:34.000000000 +0800
@@ -1136,8 +1136,20 @@
           while (!stop_reading && *k->str); /* header line within buffer */
 
           if(stop_reading)
-            /* We've stopped dealing with input, get out of the do-while loop */
-            break;
+            {
+              /* We've stopped dealing with input, get out of the do-while loop */
+              if(k->maxdownload == 0)
+                {
+                  /*For any file whose content length is 0 on the remote server,
+                   *cURL may still keep what it gets from HTTP transfer and let
+                   *user decide what to do about the empty file.
+                   */
+                  strcpy(k->str, "");
+                  result = Curl_client_write(conn, CLIENTWRITE_BODY,k->str,0);
+                }
+              break;
+            }
+          
 
           /* We might have reached the end of the header part here, but
              there might be a non-header part left in the end of the read
