uclient-http: set data_eof when content-length is 0
authorYousong Zhou <yszhou4tech@gmail.com>
Mon, 27 May 2019 02:31:57 +0000 (02:31 +0000)
committerYousong Zhou <yszhou4tech@gmail.com>
Thu, 30 May 2019 10:32:35 +0000 (10:32 +0000)
Otherwise uclient-fetch can report "Connection reset prematurely"

Fixes FS#2222

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Acked-by: Petr Štetiar <ynezz@true.cz>
uclient-http.c

index 3168f4c6a58aa372c70587318e5cd80aa4f9c492..c1f722878df76dc5452f34032ff9aac4f52e9d91 100644 (file)
@@ -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);