]> sjero.net Git - wget/commitdiff
[svn] Correctly skip error message body for keep-alive connections.
authorhniksic <devnull@localhost>
Sat, 2 Jul 2005 11:03:29 +0000 (04:03 -0700)
committerhniksic <devnull@localhost>
Sat, 2 Jul 2005 11:03:29 +0000 (04:03 -0700)
src/ChangeLog
src/http.c

index d533f2d7df26ee4ecbe3a33bfd96d286d89f49e5..a95a0441a26e82a5203f829bee7f88f5eef1857b 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-02  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * http.c (gethttp): Except for head_only, use skip_short_body to
+       skip the non-20x error message before leaving gethttp.
+
 2005-07-02  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * url.c (url_parse): Would crash when parsing fragments.  Support
index 4883fb64d7ddfaa51a93a778577e43d85cd9dc08..61819c7fc15d8e4c668c93ac57e593e54be5ecc8 100644 (file)
@@ -1884,11 +1884,17 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
       hs->len = 0;
       hs->res = 0;
       xfree_null (type);
-      /* Pre-1.10 Wget used CLOSE_INVALIDATE here.  Now we trust the
-        servers not to send body in response to a HEAD request.  If
-        you encounter such a server (more likely a broken CGI), use
-        `--no-http-keep-alive'.  */
-      CLOSE_FINISH (sock);
+      if (head_only)
+       /* Pre-1.10 Wget used CLOSE_INVALIDATE here.  Now we trust the
+          servers not to send body in response to a HEAD request.  If
+          you encounter such a server (more likely a broken CGI), use
+          `--no-http-keep-alive'.  */
+       CLOSE_FINISH (sock);
+      else if (keep_alive && skip_short_body (sock, contlen))
+       /* Successfully skipped the body; also keep using the socket. */
+       CLOSE_FINISH (sock);
+      else
+       CLOSE_INVALIDATE (sock);
       return RETRFINISHED;
     }