summaryrefslogtreecommitdiff
path: root/uclient-http.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-05-28 11:43:56 +0200
committerFelix Fietkau <nbd@openwrt.org>2014-05-28 11:43:56 +0200
commite1ed2c2250c89be3bed71f8bad038d5610178364 (patch)
treed31eb5734df0981d60fc3123b39900c4d367b11b /uclient-http.c
parentec7cbc31be11243c99a3eeee52aaa009b5a4180f (diff)
downloaduclient-e1ed2c2250c89be3bed71f8bad038d5610178364.tar.gz
http: rework authentication handling - only retry internally for GET requests
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'uclient-http.c')
-rw-r--r--uclient-http.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/uclient-http.c b/uclient-http.c
index 9652fb8..1ab336f 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -497,9 +497,6 @@ uclient_http_send_headers(struct uclient_http *uh)
if (uh->state >= HTTP_STATE_HEADERS_SENT)
return;
- if (uh->auth_type == AUTH_TYPE_UNKNOWN)
- req_type = REQ_HEAD;
-
ustream_printf(uh->us,
"%s %s HTTP/1.1\r\n"
"Host: %s\r\n",
@@ -527,7 +524,8 @@ static void uclient_http_headers_complete(struct uclient_http *uh)
uh->uc.meta = uh->meta.head;
uclient_http_process_headers(uh);
- if (auth_type == AUTH_TYPE_UNKNOWN) {
+ 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_send_headers(uh);
uh->state = HTTP_STATE_REQUEST_DONE;