-void HttpsMethod::SetupProxy() { /*{{{*/
- URI ServerName = Queue->Uri;
-
- // Determine the proxy setting - try https first, fallback to http and use env at last
- string UseProxy = _config->Find("Acquire::https::Proxy::" + ServerName.Host,
- _config->Find("Acquire::http::Proxy::" + ServerName.Host));
-
- if (UseProxy.empty() == true)
- UseProxy = _config->Find("Acquire::https::Proxy", _config->Find("Acquire::http::Proxy"));
-
- // User want to use NO proxy, so nothing to setup
- if (UseProxy == "DIRECT")
- return;
-
- if (UseProxy.empty() == false) {
- // Parse no_proxy, a comma (,) separated list of domains we don't want to use
- // a proxy for so we stop right here if it is in the list
- if (getenv("no_proxy") != 0 && CheckDomainList(ServerName.Host,getenv("no_proxy")) == true)
- return;
- } else {
- const char* result = getenv("http_proxy");
- UseProxy = result == NULL ? "" : result;
- }
-
- // Determine what host and port to use based on the proxy settings
- if (UseProxy.empty() == false) {
- Proxy = UseProxy;
- if (Proxy.Port != 1)
- curl_easy_setopt(curl, CURLOPT_PROXYPORT, Proxy.Port);
- curl_easy_setopt(curl, CURLOPT_PROXY, Proxy.Host.c_str());
- }
+// HttpsServerState::HttpsServerState - Constructor /*{{{*/
+HttpsServerState::HttpsServerState(URI Srv,HttpsMethod * Owner) : ServerState(Srv, Owner), Hash(NULL)
+{
+ TimeOut = _config->FindI("Acquire::https::Timeout",TimeOut);
+ Reset();
+}
+ /*}}}*/
+bool HttpsServerState::InitHashes(HashStringList const &ExpectedHashes) /*{{{*/
+{
+ delete Hash;
+ Hash = new Hashes(ExpectedHashes);
+ return true;
+}
+ /*}}}*/
+APT_PURE Hashes * HttpsServerState::GetHashes() /*{{{*/
+{
+ return Hash;
+}
+ /*}}}*/
+
+void HttpsMethod::SetupProxy() /*{{{*/
+{
+ URI ServerName = Queue->Uri;
+
+ // Determine the proxy setting
+ AutoDetectProxy(ServerName);
+
+ // Curl should never read proxy settings from the environment, as
+ // we determine which proxy to use. Do this for consistency among
+ // methods and prevent an environment variable overriding a
+ // no-proxy ("DIRECT") setting in apt.conf.
+ curl_easy_setopt(curl, CURLOPT_PROXY, "");
+
+ // Determine the proxy setting - try https first, fallback to http and use env at last
+ string UseProxy = _config->Find("Acquire::https::Proxy::" + ServerName.Host,
+ _config->Find("Acquire::http::Proxy::" + ServerName.Host).c_str());
+
+ if (UseProxy.empty() == true)
+ UseProxy = _config->Find("Acquire::https::Proxy", _config->Find("Acquire::http::Proxy").c_str());
+
+ // User want to use NO proxy, so nothing to setup
+ if (UseProxy == "DIRECT")
+ return;
+
+ if (UseProxy.empty() == false)
+ {
+ // Parse no_proxy, a comma (,) separated list of domains we don't want to use
+ // a proxy for so we stop right here if it is in the list
+ if (getenv("no_proxy") != 0 && CheckDomainList(ServerName.Host,getenv("no_proxy")) == true)
+ return;
+ } else {
+ const char* result = getenv("https_proxy");
+ // FIXME: Fall back to http_proxy is to remain compatible with
+ // existing setups and behaviour of apt.conf. This should be
+ // deprecated in the future (including apt.conf). Most other
+ // programs do not fall back to http proxy settings and neither
+ // should Apt.
+ if (result == NULL)
+ result = getenv("http_proxy");
+ UseProxy = result == NULL ? "" : result;
+ }
+
+ // Determine what host and port to use based on the proxy settings
+ if (UseProxy.empty() == false)
+ {
+ Proxy = UseProxy;
+ if (Proxy.Port != 1)
+ curl_easy_setopt(curl, CURLOPT_PROXYPORT, Proxy.Port);
+ curl_easy_setopt(curl, CURLOPT_PROXY, Proxy.Host.c_str());
+ if (Proxy.User.empty() == false || Proxy.Password.empty() == false)
+ {
+ curl_easy_setopt(curl, CURLOPT_PROXYUSERNAME, Proxy.User.c_str());
+ curl_easy_setopt(curl, CURLOPT_PROXYPASSWORD, Proxy.Password.c_str());
+ }
+ }