mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Check `resp_status' function return code.
This commit is contained in:
parent
ee69f96a91
commit
d829a89218
14
src/http.c
14
src/http.c
@ -1888,6 +1888,13 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
|
|||||||
|
|
||||||
resp = resp_new (head);
|
resp = resp_new (head);
|
||||||
statcode = resp_status (resp, &message);
|
statcode = resp_status (resp, &message);
|
||||||
|
if (statcode < 0)
|
||||||
|
{
|
||||||
|
logprintf (LOG_NOTQUIET, _("Invalid server response.\n"));
|
||||||
|
CLOSE_INVALIDATE (sock);
|
||||||
|
xfree (head);
|
||||||
|
return HERR;
|
||||||
|
}
|
||||||
hs->message = xstrdup (message);
|
hs->message = xstrdup (message);
|
||||||
resp_free (resp);
|
resp_free (resp);
|
||||||
xfree (head);
|
xfree (head);
|
||||||
@ -1976,6 +1983,13 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
|
|||||||
/* Check for status line. */
|
/* Check for status line. */
|
||||||
message = NULL;
|
message = NULL;
|
||||||
statcode = resp_status (resp, &message);
|
statcode = resp_status (resp, &message);
|
||||||
|
if (statcode < 0)
|
||||||
|
{
|
||||||
|
logprintf (LOG_NOTQUIET, _("Invalid server response.\n"));
|
||||||
|
CLOSE_INVALIDATE (sock);
|
||||||
|
request_free (req);
|
||||||
|
return HERR;
|
||||||
|
}
|
||||||
hs->message = xstrdup (message);
|
hs->message = xstrdup (message);
|
||||||
if (!opt.server_response)
|
if (!opt.server_response)
|
||||||
logprintf (LOG_VERBOSE, "%2d %s\n", statcode,
|
logprintf (LOG_VERBOSE, "%2d %s\n", statcode,
|
||||||
|
Loading…
Reference in New Issue
Block a user