1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

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.
This commit is contained in:
Pedro J. Estébanez
2018-04-18 20:50:31 +02:00
parent b22f048700
commit 2587fcccee
4 changed files with 52 additions and 15 deletions

View File

@@ -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 {