uclient-http: fix seq field check to use correct field
authorFelix Fietkau <nbd@nbd.name>
Sat, 31 Jan 2026 13:45:03 +0000 (14:45 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sat, 31 Jan 2026 13:46:15 +0000 (14:46 +0100)
The code was checking uh->uc.seq for changes to detect redirects, but
only uh->seq is actually incremented (in uclient_http_init_request and
uclient_http_reset_state). This meant the redirect detection check was
always comparing against an unchanging value.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
uclient-http.c
uclient.h

index 5de792460ed635e1439c9407b533d9c77adcca78..5327614b7bcc590bf861144583115e56d78a512c 100644 (file)
@@ -640,7 +640,7 @@ uclient_http_send_headers(struct uclient_http *uh)
 static void uclient_http_headers_complete(struct uclient_http *uh)
 {
        enum auth_type auth_type = uh->auth_type;
-       int seq = uh->uc.seq;
+       unsigned int seq = uh->seq;
 
        uh->state = HTTP_STATE_RECV_DATA;
        uh->uc.meta = uh->meta.head;
@@ -657,7 +657,7 @@ static void uclient_http_headers_complete(struct uclient_http *uh)
        if (uh->uc.cb->header_done)
                uh->uc.cb->header_done(&uh->uc);
 
-       if (uh->eof || seq != uh->uc.seq)
+       if (uh->eof || seq != uh->seq)
                return;
 
        if (uh->req_type == REQ_HEAD || uh->uc.status_code == 204 ||
index 772a5bd5a9952559e744ceeac4d0ca2837c32f7e..51cda53e2630ac1c2976b4e9f0326f9b6699b351 100644 (file)
--- a/uclient.h
+++ b/uclient.h
@@ -77,7 +77,6 @@ struct uclient {
        bool data_eof;
        int error_code;
        int status_code;
-       int seq;
        struct blob_attr *meta;
 
        struct uloop_timeout connection_timeout;