mirror of
https://github.com/NixOS/nix
synced 2024-10-18 00:16:11 -04:00
Merge 1c97877ec9
into 806a91f7bf
This commit is contained in:
commit
6a906c9fab
|
@ -322,7 +322,7 @@ struct curlFileTransfer : public FileTransfer
|
|||
curl_easy_setopt(req, CURLOPT_PIPEWAIT, 1);
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x072f00
|
||||
if (fileTransferSettings.enableHttp2)
|
||||
if (fileTransferSettings.enableHttp2 && !request.negotiate)
|
||||
curl_easy_setopt(req, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
|
||||
else
|
||||
curl_easy_setopt(req, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
|
@ -359,6 +359,12 @@ struct curlFileTransfer : public FileTransfer
|
|||
curl_easy_setopt(req, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
||||
if (request.negotiate) {
|
||||
curl_easy_setopt(req, CURLOPT_HTTPAUTH, CURLAUTH_NEGOTIATE);
|
||||
curl_easy_setopt(req, CURLOPT_USERNAME, "");
|
||||
curl_easy_setopt(req, CURLOPT_PASSWORD, "");
|
||||
}
|
||||
|
||||
curl_easy_setopt(req, CURLOPT_CONNECTTIMEOUT, fileTransferSettings.connectTimeout.get());
|
||||
|
||||
curl_easy_setopt(req, CURLOPT_LOW_SPEED_LIMIT, 1L);
|
||||
|
|
|
@ -64,6 +64,7 @@ struct FileTransferRequest
|
|||
std::string expectedETag;
|
||||
bool verifyTLS = true;
|
||||
bool head = false;
|
||||
bool negotiate = false;
|
||||
size_t tries = fileTransferSettings.tries;
|
||||
unsigned int baseRetryTimeMs = 250;
|
||||
ActivityId parentAct;
|
||||
|
|
|
@ -26,7 +26,6 @@ HttpBinaryCacheStoreConfig::HttpBinaryCacheStoreConfig(
|
|||
cacheUri.pop_back();
|
||||
}
|
||||
|
||||
|
||||
std::string HttpBinaryCacheStoreConfig::doc()
|
||||
{
|
||||
return
|
||||
|
@ -34,7 +33,6 @@ std::string HttpBinaryCacheStoreConfig::doc()
|
|||
;
|
||||
}
|
||||
|
||||
|
||||
class HttpBinaryCacheStore : public virtual HttpBinaryCacheStoreConfig, public virtual BinaryCacheStore
|
||||
{
|
||||
private:
|
||||
|
@ -143,10 +141,12 @@ protected:
|
|||
|
||||
FileTransferRequest makeRequest(const std::string & path)
|
||||
{
|
||||
return FileTransferRequest(
|
||||
auto request = FileTransferRequest(
|
||||
hasPrefix(path, "https://") || hasPrefix(path, "http://") || hasPrefix(path, "file://")
|
||||
? path
|
||||
: cacheUri + "/" + path);
|
||||
request.negotiate = negotiate;
|
||||
return request;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ struct HttpBinaryCacheStoreConfig : virtual BinaryCacheStoreConfig
|
|||
|
||||
Path cacheUri;
|
||||
|
||||
const Setting<bool> negotiate{this, false, "negotiate",
|
||||
"Whether to do kerberos negotiate when talking to the http binary cache."};
|
||||
|
||||
const std::string name() override
|
||||
{
|
||||
return "HTTP Binary Cache Store";
|
||||
|
|
Loading…
Reference in a new issue