summaryrefslogtreecommitdiff
path: root/uclient-http.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-04-14 23:01:53 +0200
committerFelix Fietkau <nbd@openwrt.org>2015-04-14 23:01:53 +0200
commitd2d1a9c477abe660e01943b3fee069b28b6610e0 (patch)
tree5dfe134b571d044312ac6750a318ff84d7c2ca31 /uclient-http.c
parent19c7fb01ad48b884672b7d8d252d3c290b9e883c (diff)
downloaduclient-d2d1a9c477abe660e01943b3fee069b28b6610e0.tar.gz
uclient-http: allow .header_done() callback to reset the connection
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'uclient-http.c')
-rw-r--r--uclient-http.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/uclient-http.c b/uclient-http.c
index eb69702..7e930d7 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -73,6 +73,7 @@ struct uclient_http {
struct ustream_ssl ussl;
struct uloop_timeout disconnect_t;
+ unsigned int seq;
bool ssl_require_validation;
bool ssl;
@@ -196,6 +197,7 @@ static void uclient_notify_eof(struct uclient_http *uh)
static void uclient_http_reset_state(struct uclient_http *uh)
{
+ uh->seq++;
uclient_backend_reset_state(&uh->uc);
uh->read_chunked = -1;
uh->content_length = -1;
@@ -641,6 +643,7 @@ error:
static void __uclient_notify_read(struct uclient_http *uh)
{
struct uclient *uc = &uh->uc;
+ unsigned int seq = uh->seq;
char *data;
int len;
@@ -675,6 +678,9 @@ static void __uclient_notify_read(struct uclient_http *uh)
*sep = 0;
cur_len = sep + 2 - data;
uclient_parse_http_line(uh, data);
+ if (seq != uh->seq)
+ return;
+
ustream_consume(uh->us, cur_len);
len -= cur_len;