From: Felix Fietkau Date: Wed, 20 Jan 2016 09:51:58 +0000 (+0100) Subject: http: fix connection close handling on auth X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1939499081e651e192f5ad6bb84f45646edd6b02;p=oweals%2Fuclient.git http: fix connection close handling on auth Signed-off-by: Felix Fietkau --- 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);