From 07d27b9d0a6f77cfd05cc0a2a2b6a3b9446e32a9 Mon Sep 17 00:00:00 2001 From: des Date: Wed, 19 Jun 2002 08:36:00 +0000 Subject: Don't try to dereference conn when we know it's NULL. --- lib/libfetch/http.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/libfetch/http.c') diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 68497e9..99b34ff 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -766,7 +766,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, conn_t *conn; struct url *url, *new; int chunked, direct, need_auth, noredirect, verbose; - int i, n; + int e, i, n; off_t offset, clength, length, size; time_t mtime; const char *p; @@ -793,6 +793,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, n = noredirect ? 1 : MAX_REDIRECT; i = 0; + e = HTTP_PROTOCOL_ERROR; need_auth = 0; do { new = NULL; @@ -990,6 +991,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, /* we need to provide authentication */ if (conn->err == HTTP_NEED_AUTH) { + e = conn->err; need_auth = 1; _fetch_close(conn); conn = NULL; @@ -997,6 +999,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, } /* all other cases: we got a redirect */ + e = conn->err; need_auth = 0; _fetch_close(conn); conn = NULL; @@ -1011,7 +1014,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, /* we failed, or ran out of retries */ if (conn == NULL) { - _http_seterr(conn->err); + _http_seterr(e); goto ouch; } -- cgit v1.1