From d2d1a9c477abe660e01943b3fee069b28b6610e0 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 Apr 2015 23:01:53 +0200 Subject: [PATCH] uclient-http: allow .header_done() callback to reset the connection Signed-off-by: Felix Fietkau --- uclient-http.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.25.1