Don't forget to set file descriptor to -1 after closing it, since the code
outside the loop inspects it to determine whether or not we succeeded in retrieving the requested document. This fixes a bug where fetchGetHTTP() would return a FILE with an invalid file descriptor if it hit the redirect limit without locating the requested document.
This commit is contained in:
parent
5cd33c40d7
commit
c789727701
@ -777,7 +777,6 @@ _http_request(struct url *URL, char *op, struct url_stat *us, char *flags)
|
||||
chunked = 0;
|
||||
need_auth = 0;
|
||||
offset = 0;
|
||||
fd = -1;
|
||||
retry:
|
||||
/* connect to server or proxy */
|
||||
if ((fd = _http_connect(url, &proxy, flags)) == -1)
|
||||
@ -935,6 +934,7 @@ _http_request(struct url *URL, char *op, struct url_stat *us, char *flags)
|
||||
|
||||
/* we have a redirect */
|
||||
close(fd);
|
||||
fd = -1;
|
||||
if (url != URL)
|
||||
fetchFreeURL(url);
|
||||
url = new;
|
||||
|
Loading…
Reference in New Issue
Block a user