diff mbox series

[OpenWrt-Devel,uclient] uclient-http: set data_eof when content-length is 0

Message ID 20190527024550.16684-1-yszhou4tech@gmail.com
State Accepted, archived
Headers show
Series [OpenWrt-Devel,uclient] uclient-http: set data_eof when content-length is 0 | expand

Commit Message

Yousong Zhou May 27, 2019, 2:45 a.m. UTC
Otherwise uclient-fetch can report "Connection reset prematurely"

Fixes FS#2222

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 uclient-http.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Petr Štetiar May 30, 2019, 10:02 a.m. UTC | #1
Yousong Zhou <yszhou4tech@gmail.com> [2019-05-27 02:45:50]:

Hi,

> Otherwise uclient-fetch can report "Connection reset prematurely"

just checked this, thanks for taking care of this.

Acked-by: Petr Štetiar <ynezz@true.cz>
diff mbox series

Patch

diff --git a/uclient-http.c b/uclient-http.c
index 3168f4c..c1f7228 100644
--- a/uclient-http.c
+++ b/uclient-http.c
@@ -199,7 +199,8 @@  static void uclient_notify_eof(struct uclient_http *uh)
 			return;
 	}
 
-	if (uh->content_length < 0 && uh->read_chunked >= 0)
+	if ((uh->content_length < 0 && uh->read_chunked >= 0) ||
+			uh->content_length == 0)
 		uh->uc.data_eof = true;
 
 	uclient_backend_set_eof(&uh->uc);