Merge pull request #25944 from Faless/net/http_editor_fixes

Fix keep-alive without header in HTTP client
This commit is contained in:
Rémi Verschelde 2019-02-16 17:58:48 +01:00 committed by GitHub
commit ca5ec803fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -426,11 +426,10 @@ Error HTTPClient::poll() {
response_headers.clear(); response_headers.clear();
response_num = RESPONSE_OK; response_num = RESPONSE_OK;
// Per the HTTP 1.1 spec, keep-alive is the default, but in practice // Per the HTTP 1.1 spec, keep-alive is the default.
// it's safe to assume it only if the explicit header is found, allowing // Not following that specification breaks standard implemetations.
// to handle body-up-to-EOF responses on naive servers; that's what Curl // Broken web servers should be fixed.
// and browsers do bool keep_alive = true;
bool keep_alive = false;
for (int i = 0; i < responses.size(); i++) { for (int i = 0; i < responses.size(); i++) {
@ -447,8 +446,8 @@ Error HTTPClient::poll() {
if (encoding == "chunked") { if (encoding == "chunked") {
chunked = true; chunked = true;
} }
} else if (s.begins_with("connection: keep-alive")) { } else if (s.begins_with("connection: close")) {
keep_alive = true; keep_alive = false;
} }
if (i == 0 && responses[i].begins_with("HTTP")) { if (i == 0 && responses[i].begins_with("HTTP")) {

View file

@ -1338,6 +1338,7 @@ void EditorAssetLibrary::_bind_methods() {
EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
requesting = REQUESTING_NONE;
templates_only = p_templates_only; templates_only = p_templates_only;
VBoxContainer *library_main = memnew(VBoxContainer); VBoxContainer *library_main = memnew(VBoxContainer);