summaryrefslogtreecommitdiff
path: root/uclient-http.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-16 18:50:22 +0100
committerFelix Fietkau <nbd@openwrt.org>2016-01-16 18:50:22 +0100
commit057a89885bb9dc4cf3a6e9dfc4be04ad72c4f8f0 (patch)
treef3fe360511ee07ec61ca58e7d1a8b5c87b3958b4 /uclient-http.c
parentb94caa406f4e5c1db4691735ba4969b002dc978f (diff)
downloaduclient-057a89885bb9dc4cf3a6e9dfc4be04ad72c4f8f0.tar.gz
http: allow the header_done callback to reset the client state
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'uclient-http.c')
-rw-r--r--uclient-http.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/uclient-http.c b/uclient-http.c
index 676ce1b..e456564 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -211,6 +211,7 @@ static void uclient_http_reset_state(struct uclient_http *uh)
static void uclient_http_init_request(struct uclient_http *uh)
{
+ uh->seq++;
uclient_http_reset_state(uh);
blob_buf_init(&uh->meta, 0);
}
@@ -561,6 +562,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;
uh->state = HTTP_STATE_RECV_DATA;
uh->uc.meta = uh->meta.head;
@@ -577,7 +579,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)
+ if (uh->eof || seq != uh->uc.seq)
return;
if (uh->req_type == REQ_HEAD || uh->uc.status_code == 204) {