From: hniksic Date: Sat, 2 Jul 2005 11:03:29 +0000 (-0700) Subject: [svn] Correctly skip error message body for keep-alive connections. X-Git-Tag: v1.13~824 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=025fcc29a8eba8b26d6e56c4be0efaad7a580442 [svn] Correctly skip error message body for keep-alive connections. --- diff --git a/src/ChangeLog b/src/ChangeLog index d533f2d7..a95a0441 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-07-02 Hrvoje Niksic + + * 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 * url.c (url_parse): Would crash when parsing fragments. Support diff --git a/src/http.c b/src/http.c index 4883fb64..61819c7f 100644 --- a/src/http.c +++ b/src/http.c @@ -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; }