]> sjero.net Git - wget/commitdiff
[svn] Invalidate socket if get_contents encountered an error.
authorhniksic <devnull@localhost>
Mon, 14 Jan 2002 01:39:16 +0000 (17:39 -0800)
committerhniksic <devnull@localhost>
Mon, 14 Jan 2002 01:39:16 +0000 (17:39 -0800)
Published in <sxsita54sqy.fsf@florida.arsdigita.de>.

src/ChangeLog
src/http.c

index eed212c8846ec0db0f11a1e684da87bb93c1dcf4..790a8527904d1cc83ebd8dcfc5757bc4cc02dabb 100644 (file)
@@ -1,3 +1,8 @@
+2002-01-14  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * http.c (gethttp): Invalidate SOCK if get_contents encountered an
+       error.
+
 2001-12-24  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * version.c: Wget 1.8.1 is released.
index ad354eed788b414aadf6826afe6c907810cd922a..b615df965ff21d0e8acc296ef4a7af515c626db5 100644 (file)
@@ -1357,6 +1357,11 @@ Refusing to truncate existing file `%s'.\n\n"), *hs->local_file);
                          (contlen != -1 ? contlen : 0),
                          &rbuf, keep_alive, &hs->dltime);
 
+  if (hs->res >= 0)
+    CLOSE_FINISH (sock);
+  else
+    CLOSE_INVALIDATE (sock);
+
   {
     /* Close or flush the file.  We have to be careful to check for
        error here.  Checking the result of fwrite() is not enough --
@@ -1370,7 +1375,6 @@ Refusing to truncate existing file `%s'.\n\n"), *hs->local_file);
       hs->res = -2;
   }
   FREE_MAYBE (all_headers);
-  CLOSE_FINISH (sock);
   if (hs->res == -2)
     return FWRITEERR;
   return RETRFINISHED;