summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-20 10:51:58 +0100
committerFelix Fietkau <nbd@openwrt.org>2016-01-20 10:51:58 +0100
commit1939499081e651e192f5ad6bb84f45646edd6b02 (patch)
treeebf488a889ada27cf6714e7110bb31196a8704bd
parent2bbd1770b7929d911301f43c291b27d18969dcb1 (diff)
downloaduclient-1939499081e651e192f5ad6bb84f45646edd6b02.tar.gz
http: fix connection close handling on auth
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--uclient-http.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/uclient-http.c b/uclient-http.c
index fa66f78..195fa1c 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -108,6 +108,8 @@ static const char * const uclient_http_prefix[] = {
[__PREFIX_MAX] = NULL
};
+static int uclient_http_connect(struct uclient *cl);
+
static int uclient_do_connect(struct uclient_http *uh, const char *port)
{
socklen_t sl;
@@ -575,7 +577,7 @@ static void uclient_http_headers_complete(struct uclient_http *uh)
if (auth_type == AUTH_TYPE_UNKNOWN && uh->uc.status_code == 401 &&
(uh->req_type == REQ_HEAD || uh->req_type == REQ_GET)) {
- uclient_http_init_request(uh);
+ uclient_http_connect(&uh->uc);
uclient_http_send_headers(uh);
uh->state = HTTP_STATE_REQUEST_DONE;
return;
@@ -848,7 +850,7 @@ static int uclient_http_connect(struct uclient *cl)
struct uclient_http *uh = container_of(cl, struct uclient_http, uc);
int ret;
- if (!cl->eof || uh->disconnect)
+ if (!cl->eof || uh->disconnect || uh->connection_close)
uclient_http_disconnect(uh);
uclient_http_init_request(uh);