diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-02-16 17:58:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-16 17:58:48 +0100 |
commit | ca5ec803fc710ce95c11abc89d7773d8b4ce22b5 (patch) | |
tree | 767e9a544938e7c92c5cdd6da0283a541ac492ab /core/io/http_client.cpp | |
parent | ee464f56c440ee158fe28f7d3b750280bc63890d (diff) | |
parent | 673caa5f462e4f89ffae65b111a9817d29467277 (diff) | |
download | redot-engine-ca5ec803fc710ce95c11abc89d7773d8b4ce22b5.tar.gz |
Merge pull request #25944 from Faless/net/http_editor_fixes
Fix keep-alive without header in HTTP client
Diffstat (limited to 'core/io/http_client.cpp')
-rw-r--r-- | core/io/http_client.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index b3fd814870..b25b1934ff 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -426,11 +426,10 @@ Error HTTPClient::poll() { response_headers.clear(); response_num = RESPONSE_OK; - // Per the HTTP 1.1 spec, keep-alive is the default, but in practice - // it's safe to assume it only if the explicit header is found, allowing - // to handle body-up-to-EOF responses on naive servers; that's what Curl - // and browsers do - bool keep_alive = false; + // Per the HTTP 1.1 spec, keep-alive is the default. + // Not following that specification breaks standard implemetations. + // Broken web servers should be fixed. + bool keep_alive = true; for (int i = 0; i < responses.size(); i++) { @@ -447,8 +446,8 @@ Error HTTPClient::poll() { if (encoding == "chunked") { chunked = true; } - } else if (s.begins_with("connection: keep-alive")) { - keep_alive = true; + } else if (s.begins_with("connection: close")) { + keep_alive = false; } if (i == 0 && responses[i].begins_with("HTTP")) { |