From d19ee8dba4368862c8c054e0f5d44f83958472ae Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 18 Oct 2002 16:51:57 +0000 Subject: [PATCH] http_proxy and http_proxy_username in configrc --- panda/src/downloader/config_downloader.cxx | 7 +++++++ panda/src/downloader/config_downloader.h | 2 ++ panda/src/downloader/httpClient.cxx | 10 ++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/panda/src/downloader/config_downloader.cxx b/panda/src/downloader/config_downloader.cxx index 45fa8adb0f..a647328970 100644 --- a/panda/src/downloader/config_downloader.cxx +++ b/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(); diff --git a/panda/src/downloader/config_downloader.h b/panda/src/downloader/config_downloader.h index 207192e1a1..4713b5b3d0 100644 --- a/panda/src/downloader/config_downloader.h +++ b/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 diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index ae2e80a235..c973dafe8d 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/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 ©) { - // 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 ©) { _proxy = copy._proxy; _http_version = copy._http_version; _verify_ssl = copy._verify_ssl; + _usernames = copy._usernames; clear_expected_servers(); ExpectedServers::const_iterator ei;