From: Moritz <52993648+moha-gh@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:23:46 +0000 (+0200) Subject: fix(http-storage): Make sure 'keep-alive' can be overridden as expected (#1510) X-Git-Tag: v4.11~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de454cb861efef76fa94a00c2f7b738935a4a96b;p=thirdparty%2Fccache.git fix(http-storage): Make sure 'keep-alive' can be overridden as expected (#1510) The changes introduced in dfcdb68 made it impossible to disable HTTP keep-alive by setting the 'keep-alive' attribute in the backend string accordingly: The default of 'true' is applied after parsing of the attributes, overriding the value configured by the user (if any). Rectify this. --- diff --git a/src/ccache/storage/remote/httpstorage.cpp b/src/ccache/storage/remote/httpstorage.cpp index 9438c45e..d51e9404 100644 --- a/src/ccache/storage/remote/httpstorage.cpp +++ b/src/ccache/storage/remote/httpstorage.cpp @@ -119,6 +119,8 @@ HttpStorageBackend::HttpStorageBackend( m_http_client.set_basic_auth(std::string(user), std::string(*password)); } + m_http_client.set_keep_alive(true); + auto connect_timeout = k_default_connect_timeout; auto operation_timeout = k_default_operation_timeout; @@ -159,7 +161,6 @@ HttpStorageBackend::HttpStorageBackend( m_http_client.set_connection_timeout(connect_timeout); m_http_client.set_read_timeout(operation_timeout); m_http_client.set_write_timeout(operation_timeout); - m_http_client.set_keep_alive(true); m_http_client.set_default_headers(default_headers); }