summaryrefslogtreecommitdiffstats
path: root/net/http/http_proxy_client_socket_pool.h
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 16:00:05 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-25 16:00:05 +0000
commit8dbf33e8cf8658a02aebdde2202cd882c488211d (patch)
tree61090c9ba6eecee4b05a60568950d37f4ea4ffed /net/http/http_proxy_client_socket_pool.h
parent381ea555123f1cdb465ea8d542fa2145121ac3e1 (diff)
downloadchromium_src-8dbf33e8cf8658a02aebdde2202cd882c488211d.zip
chromium_src-8dbf33e8cf8658a02aebdde2202cd882c488211d.tar.gz
chromium_src-8dbf33e8cf8658a02aebdde2202cd882c488211d.tar.bz2
Add support for speaking SSL to an HTTP Proxy, to
HttpProxyClientSocketPool (and friends) More information about an HTTPS Proxy can be found here: http://dev.chromium.org/spdy/spdy-proxy This implementation supports both http:// and https:// requests, as well as support for both Proxy and Server auth. BUG=29625 TEST=none Review URL: http://codereview.chromium.org/3110006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57333 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_proxy_client_socket_pool.h')
-rw-r--r--net/http/http_proxy_client_socket_pool.h40
1 files changed, 30 insertions, 10 deletions
diff --git a/net/http/http_proxy_client_socket_pool.h b/net/http/http_proxy_client_socket_pool.h
index 3e3df7c..c992cf0 100644
--- a/net/http/http_proxy_client_socket_pool.h
+++ b/net/http/http_proxy_client_socket_pool.h
@@ -22,12 +22,19 @@ namespace net {
class HostResolver;
class HttpNetworkSession;
+class SSLClientSocketPool;
+class SSLSocketParams;
class TCPClientSocketPool;
class TCPSocketParams;
+// HttpProxySocketParams only needs the socket params for one of the proxy
+// types. The other param must be NULL. When using an HTTP Proxy,
+// |tcp_params| must be set. When using an HTTPS Proxy, |ssl_params|
+// must be set.
class HttpProxySocketParams : public base::RefCounted<HttpProxySocketParams> {
public:
- HttpProxySocketParams(const scoped_refptr<TCPSocketParams>& proxy_server,
+ HttpProxySocketParams(const scoped_refptr<TCPSocketParams>& tcp_params,
+ const scoped_refptr<SSLSocketParams>& ssl_params,
const GURL& request_url,
const std::string& user_agent,
HostPortPair endpoint,
@@ -37,12 +44,16 @@ class HttpProxySocketParams : public base::RefCounted<HttpProxySocketParams> {
const scoped_refptr<TCPSocketParams>& tcp_params() const {
return tcp_params_;
}
+ const scoped_refptr<SSLSocketParams>& ssl_params() const {
+ return ssl_params_;
+ }
const GURL& request_url() const { return request_url_; }
const std::string& user_agent() const { return user_agent_; }
const HostPortPair& endpoint() const { return endpoint_; }
const scoped_refptr<HttpNetworkSession>& session() {
return session_;
}
+ const HostResolver::RequestInfo& destination() const;
bool tunnel() const { return tunnel_; }
private:
@@ -50,6 +61,7 @@ class HttpProxySocketParams : public base::RefCounted<HttpProxySocketParams> {
~HttpProxySocketParams();
const scoped_refptr<TCPSocketParams> tcp_params_;
+ const scoped_refptr<SSLSocketParams> ssl_params_;
const GURL request_url_;
const std::string user_agent_;
const HostPortPair endpoint_;
@@ -67,6 +79,7 @@ class HttpProxyConnectJob : public ConnectJob {
const scoped_refptr<HttpProxySocketParams>& params,
const base::TimeDelta& timeout_duration,
const scoped_refptr<TCPClientSocketPool>& tcp_pool,
+ const scoped_refptr<SSLClientSocketPool>& ssl_pool,
const scoped_refptr<HostResolver> &host_resolver,
Delegate* delegate,
NetLog* net_log);
@@ -79,6 +92,8 @@ class HttpProxyConnectJob : public ConnectJob {
enum State {
kStateTCPConnect,
kStateTCPConnectComplete,
+ kStateSSLConnect,
+ kStateSSLConnectComplete,
kStateHttpProxyConnect,
kStateHttpProxyConnectComplete,
kStateNone,
@@ -98,19 +113,25 @@ class HttpProxyConnectJob : public ConnectJob {
// Runs the state transition loop.
int DoLoop(int result);
+ // Connecting to HTTP Proxy
int DoTCPConnect();
int DoTCPConnectComplete(int result);
+ // Connecting to HTTPS Proxy
+ int DoSSLConnect();
+ int DoSSLConnectComplete(int result);
+
int DoHttpProxyConnect();
int DoHttpProxyConnectComplete(int result);
scoped_refptr<HttpProxySocketParams> params_;
const scoped_refptr<TCPClientSocketPool> tcp_pool_;
+ const scoped_refptr<SSLClientSocketPool> ssl_pool_;
const scoped_refptr<HostResolver> resolver_;
State next_state_;
CompletionCallbackImpl<HttpProxyConnectJob> callback_;
- scoped_ptr<ClientSocketHandle> tcp_socket_handle_;
- scoped_ptr<ClientSocket> socket_;
+ scoped_ptr<ClientSocketHandle> transport_socket_handle_;
+ scoped_ptr<ClientSocket> transport_socket_;
DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJob);
};
@@ -123,6 +144,7 @@ class HttpProxyClientSocketPool : public ClientSocketPool {
const scoped_refptr<ClientSocketPoolHistograms>& histograms,
const scoped_refptr<HostResolver>& host_resolver,
const scoped_refptr<TCPClientSocketPool>& tcp_pool,
+ const scoped_refptr<SSLClientSocketPool>& ssl_pool,
NetLog* net_log);
// ClientSocketPool methods:
@@ -171,25 +193,23 @@ class HttpProxyClientSocketPool : public ClientSocketPool {
public:
HttpProxyConnectJobFactory(
const scoped_refptr<TCPClientSocketPool>& tcp_pool,
+ const scoped_refptr<SSLClientSocketPool>& ssl_pool,
HostResolver* host_resolver,
- NetLog* net_log)
- : tcp_pool_(tcp_pool),
- host_resolver_(host_resolver),
- net_log_(net_log) {}
-
- virtual ~HttpProxyConnectJobFactory() {}
+ NetLog* net_log);
// ClientSocketPoolBase::ConnectJobFactory methods.
virtual ConnectJob* NewConnectJob(const std::string& group_name,
const PoolBase::Request& request,
ConnectJob::Delegate* delegate) const;
- virtual base::TimeDelta ConnectionTimeout() const;
+ virtual base::TimeDelta ConnectionTimeout() const { return timeout_; }
private:
const scoped_refptr<TCPClientSocketPool> tcp_pool_;
+ const scoped_refptr<SSLClientSocketPool> ssl_pool_;
const scoped_refptr<HostResolver> host_resolver_;
NetLog* net_log_;
+ base::TimeDelta timeout_;
DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory);
};