Browse Source

http_proxy and http_proxy_username in configrc

David Rose 23 years ago
parent
commit
d19ee8dba4

+ 7 - 0
panda/src/downloader/config_downloader.cxx

@@ -78,6 +78,13 @@ config_downloader.GetBool("early-random-seed", true);
 const bool verify_ssl =
 config_downloader.GetBool("verify-ssl", true);
 
+// This specifies the proxy that we will contact for all HTTP
+// connections that don't specify otherwise.
+const string http_proxy =
+config_downloader.GetString("http-proxy", "");
+const string http_proxy_username =
+config_downloader.GetString("http-proxy-username", "");
+
 ConfigureFn(config_downloader) {
 #ifdef HAVE_SSL
   HTTPChannel::init_type();

+ 2 - 0
panda/src/downloader/config_downloader.h

@@ -40,5 +40,7 @@ extern const int patcher_buffer_size;
 
 extern const bool early_random_seed;
 extern const bool verify_ssl;
+extern const string http_proxy;
+extern const string http_proxy_username;
 
 #endif

+ 6 - 4
panda/src/downloader/httpClient.cxx

@@ -55,6 +55,11 @@ HTTPClient() {
   _verify_ssl = verify_ssl ? VS_normal : VS_no_verify;
   _ssl_ctx = (SSL_CTX *)NULL;
 
+  _proxy = URLSpec(http_proxy, 1);
+  if (!http_proxy_username.empty()) {
+    set_username("*proxy", "", http_proxy_username);
+  }
+
   // The first time we create an HTTPClient, we must initialize the
   // OpenSSL library.
   if (!_ssl_initialized) {
@@ -69,10 +74,6 @@ HTTPClient() {
 ////////////////////////////////////////////////////////////////////
 HTTPClient::
 HTTPClient(const HTTPClient &copy) {
-  // We can initialize these to default values because the operator =
-  // function will copy them in a second.
-  _http_version = HV_11;
-  _verify_ssl = verify_ssl ? VS_normal : VS_no_verify;
   _ssl_ctx = (SSL_CTX *)NULL;
 
   (*this) = copy;
@@ -88,6 +89,7 @@ operator = (const HTTPClient &copy) {
   _proxy = copy._proxy;
   _http_version = copy._http_version;
   _verify_ssl = copy._verify_ssl;
+  _usernames = copy._usernames;
   clear_expected_servers();
 
   ExpectedServers::const_iterator ei;