diff options
| author | Felix Fietkau | 2026-02-13 07:30:42 +0000 |
|---|---|---|
| committer | Felix Fietkau | 2026-02-13 07:30:42 +0000 |
| commit | 63413daa876066484a4ee62803aa943f3f19348c (patch) | |
| tree | 3f1b992ebc28d8163775762165af7d22cf9cd6bd | |
| parent | 931bbfeb2c92ecaa8ca2262b9bef27df8614ffb9 (diff) | |
| download | uclient-63413daa876066484a4ee62803aa943f3f19348c.tar.gz | |
uclient-http: fix HTTP authentication after deferred header processing
Move uclient_http_process_headers() into the deferred callback so that
auth_type is captured before it gets updated. The previous refactor in
commit 80c9bd29c233 ("uclient-http: fix hang on HTTP to HTTPS redirect")
moved the auth_type snapshot after uclient_http_process_headers() had
already changed it from AUTH_TYPE_UNKNOWN, causing the 401 retry path
to never trigger.
Fixes: https://github.com/openwrt/uclient/issues/14
Signed-off-by: Felix Fietkau <nbd@nbd.name>
| -rw-r--r-- | uclient-http.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/uclient-http.c b/uclient-http.c index fce62bb..5e46e70 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -647,6 +647,8 @@ static void uclient_http_process_headers_cb(struct uloop_timeout *timeout) enum auth_type auth_type = uh->auth_type; unsigned int seq = uh->seq; + uclient_http_process_headers(uh); + if (auth_type == AUTH_TYPE_UNKNOWN && uh->uc.status_code == 401 && (uh->req_type == REQ_HEAD || uh->req_type == REQ_GET)) { uclient_http_connect(&uh->uc); @@ -677,7 +679,6 @@ static void uclient_http_headers_complete(struct uclient_http *uh) { uh->state = HTTP_STATE_PROCESS_HEADERS; uh->uc.meta = uh->meta.head; - uclient_http_process_headers(uh); uh->process_headers_t.cb = uclient_http_process_headers_cb; uloop_timeout_set(&uh->process_headers_t, 1); |