From 2587fcccee3b9ee2b934f681f9f3ff921edf096f Mon Sep 17 00:00:00 2001 From: Pedro J. Estébanez Date: Wed, 18 Apr 2018 20:50:31 +0200 Subject: Allow body-up-to-EOF HTTP responses Implements the same heuristic as Curl (and web browsers): if no `Content-Length`, no `Connection: keep-alive` and no chunked transfer encoding, assume th rest of the data until EOF is the body, gracefully setting the HTTP client back to the disconnected state. Theoretically, this is not compliant with HTTP 1.1, by which `keep-alive` is the default, but in practice, an explicit header is sent by servers. --- drivers/unix/stream_peer_tcp_posix.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/unix/stream_peer_tcp_posix.cpp') diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp index 17112e5ab..b19bdc460 100644 --- a/drivers/unix/stream_peer_tcp_posix.cpp +++ b/drivers/unix/stream_peer_tcp_posix.cpp @@ -290,6 +290,7 @@ Error StreamPeerTCPPosix::read(uint8_t *p_buffer, int p_bytes, int &r_received, status = STATUS_NONE; peer_port = 0; peer_host = IP_Address(); + r_received = total_read; return ERR_FILE_EOF; } else { -- cgit v1.2.3-70-g09d2