Browse Source

net: http: client: Return error if waiting timeout

Return error to the caller if no data was received or there
was some other error. Earlier we did not check the error
condition properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
pull/69485/head
Jukka Rissanen 2 years ago committed by Fabio Baltieri
parent
commit
28a46c0f60
  1. 10
      subsys/net/lib/http/http_client.c

10
subsys/net/lib/http/http_client.c

@ -717,10 +717,16 @@ int http_client_req(int sock, struct http_request *req, @@ -717,10 +717,16 @@ int http_client_req(int sock, struct http_request *req,
total_recv = http_wait_data(sock, req, timeout);
if (total_recv < 0) {
NET_DBG("Wait data failure (%d)", total_recv);
} else {
NET_DBG("Received %d bytes", total_recv);
ret = total_recv;
goto out;
} else if (total_recv == 0) {
NET_DBG("Timeout while waiting data");
ret = -ETIMEDOUT;
goto out;
}
NET_DBG("Received %d bytes", total_recv);
return total_sent;
out:

Loading…
Cancel
Save