From d02b40dce8d188b3dfdfa3ec2f9932da14adbc07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BAnio=20Teixeira?= <metal-away@live.com>
Date: Sun, 23 Jun 2019 03:22:59 -0300
Subject: [PATCH] Http download issue when connection lost (#723)

* Fix bug when read returns -1

When the socket down the "read" function returns -1.
Then the while(read_byte > 0) only works for signed types.

* Remove printf debug line
---
 extras/http_client_ota/http_buffered_client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/extras/http_client_ota/http_buffered_client.c b/extras/http_client_ota/http_buffered_client.c
index ef792a6..2d6e276 100644
--- a/extras/http_client_ota/http_buffered_client.c
+++ b/extras/http_client_ota/http_buffered_client.c
@@ -110,7 +110,8 @@ static inline void parse_http_header(char *header)
 HTTP_Client_State HttpClient_dowload(Http_client_info *info)
 {
     struct addrinfo *res;
-    unsigned int tot_http_pdu_rd, read_byte, full;
+    unsigned int tot_http_pdu_rd, full;
+    ssize_t read_byte;
     int err, sock;
     char *wrt_ptr;