http_proxy and http_proxy_username in configrc

This commit is contained in:
David Rose 2002-10-18 16:51:57 +00:00
parent 27df52fbfe
commit d19ee8dba4
3 changed files with 15 additions and 4 deletions

View File

@ -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();

View File

@ -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

View File

@ -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;