mirror of
https://github.com/mirror/wget.git
synced 2025-01-30 06:10:08 +08:00
Don't assume a 416 response has no body
* http.c(gethttp): In case of a 416 response, try to drain the socket of any bytes before reusing the connection Reported-By: Iru Cai <mytbk920423@gmail.com>
This commit is contained in:
parent
6aa6b669ef
commit
693cee0109
11
src/http.c
11
src/http.c
@ -3969,11 +3969,16 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
|
||||
hs->res = 0;
|
||||
/* Mark as successfully retrieved. */
|
||||
*dt |= RETROKF;
|
||||
if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE)
|
||||
|
||||
/* Try to maintain the keep-alive connection. It is often cheaper to
|
||||
* consume some bytes which have already been sent than to negotiate
|
||||
* a new connection. However, if the body is too large, or we don't
|
||||
* care about keep-alive, then simply terminate the connection */
|
||||
if (keep_alive &&
|
||||
skip_short_body (sock, contlen, chunked_transfer_encoding))
|
||||
CLOSE_FINISH (sock);
|
||||
else
|
||||
CLOSE_INVALIDATE (sock); /* would be CLOSE_FINISH, but there
|
||||
might be more bytes in the body. */
|
||||
CLOSE_INVALIDATE (sock);
|
||||
retval = RETRUNNEEDED;
|
||||
goto cleanup;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user