add set_allow_proxy

This commit is contained in:
David Rose 2003-06-12 16:22:23 +00:00
parent 5a7a566ec7
commit b6ad0bf0aa
3 changed files with 38 additions and 1 deletions

View File

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

View File

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

View File

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