diff --git a/panda/src/downloader/httpChannel.I b/panda/src/downloader/httpChannel.I index 1b46104ebf..c8baf54636 100644 --- a/panda/src/downloader/httpChannel.I +++ b/panda/src/downloader/httpChannel.I @@ -211,6 +211,36 @@ get_persistent_connection() const { return _persistent_connection; } +//////////////////////////////////////////////////////////////////// +// Function: HTTPChannel::set_allow_proxy +// Access: Published +// Description: If this is true (the normal case), the HTTPClient +// will be consulted for information about the proxy to +// be used for each connection via this HTTPChannel. If +// this has been set to false by the user, then all +// connections will be made directly, regardless of the +// proxy settings indicated on the HTTPClient. +//////////////////////////////////////////////////////////////////// +INLINE void HTTPChannel:: +set_allow_proxy(bool allow_proxy) { + _allow_proxy = allow_proxy; +} + +//////////////////////////////////////////////////////////////////// +// Function: HTTPChannel::get_allow_proxy +// Access: Published +// Description: If this is true (the normal case), the HTTPClient +// will be consulted for information about the proxy to +// be used for each connection via this HTTPChannel. If +// this has been set to false by the user, then all +// connections will be made directly, regardless of the +// proxy settings indicated on the HTTPClient. +//////////////////////////////////////////////////////////////////// +INLINE bool HTTPChannel:: +get_allow_proxy() const { + return _allow_proxy; +} + //////////////////////////////////////////////////////////////////// // Function: HTTPChannel::set_connect_timeout // Access: Published diff --git a/panda/src/downloader/httpChannel.cxx b/panda/src/downloader/httpChannel.cxx index bce78173d4..577adf6e2b 100644 --- a/panda/src/downloader/httpChannel.cxx +++ b/panda/src/downloader/httpChannel.cxx @@ -43,6 +43,7 @@ HTTPChannel(HTTPClient *client) : { _proxy_next_index = 0; _persistent_connection = false; + _allow_proxy = true; _connect_timeout = connect_timeout; _http_timeout = http_timeout; _blocking_connect = false; @@ -1794,7 +1795,9 @@ begin_request(HTTPEnum::Method method, const DocumentSpec &url, // Get the set of proxies that are appropriate for this URL. _proxies.clear(); _proxy_next_index = 0; - _client->get_proxies_for_url(url.get_url(), _proxies); + if (get_allow_proxy()) { + _client->get_proxies_for_url(url.get_url(), _proxies); + } // If we still have a live connection to a proxy that is on the // list, that proxy should be moved immediately to the front of the diff --git a/panda/src/downloader/httpChannel.h b/panda/src/downloader/httpChannel.h index 0612e5456d..e8ea2783df 100644 --- a/panda/src/downloader/httpChannel.h +++ b/panda/src/downloader/httpChannel.h @@ -91,6 +91,9 @@ PUBLISHED: INLINE void set_persistent_connection(bool persistent_connection); INLINE bool get_persistent_connection() const; + INLINE void set_allow_proxy(bool allow_proxy); + INLINE bool get_allow_proxy() const; + INLINE void set_connect_timeout(double timeout_seconds); INLINE double get_connect_timeout() const; INLINE void set_blocking_connect(bool blocking_connect); @@ -221,6 +224,7 @@ private: PT(BioPtr) _bio; PT(BioStreamPtr) _source; bool _persistent_connection; + bool _allow_proxy; double _connect_timeout; double _http_timeout; bool _blocking_connect;