Skip to content

Commit

Permalink
net: http: client: Return error if waiting timeout
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jukkar committed Feb 14, 2024
1 parent d323aca commit ddab14c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions subsys/net/lib/http/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ddab14c

Please sign in to comment.