]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix(http-storage): Make sure 'keep-alive' can be overridden as expected (#1510)
authorMoritz <52993648+moha-gh@users.noreply.github.com>
Sat, 21 Sep 2024 08:23:46 +0000 (10:23 +0200)
committerGitHub <noreply@github.com>
Sat, 21 Sep 2024 08:23:46 +0000 (10:23 +0200)
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.

src/ccache/storage/remote/httpstorage.cpp

index 9438c45ec878efd754fa302bbdbbf2040decfe59..d51e9404dc0ea87fdeb0165f1c7b3cb71feef79a 100644 (file)
@@ -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);
 }