diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 02:03:33 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 02:03:33 +0000 |
commit | 3f55aa10587b3eaa629d7e95de87998b399fe3e2 (patch) | |
tree | 0f407a7e7fc837bed337a9a5af787edbd9473ef6 /net/http | |
parent | b456003a580041d83e7f5a998c15f62ce380560f (diff) | |
download | chromium_src-3f55aa10587b3eaa629d7e95de87998b399fe3e2.zip chromium_src-3f55aa10587b3eaa629d7e95de87998b399fe3e2.tar.gz chromium_src-3f55aa10587b3eaa629d7e95de87998b399fe3e2.tar.bz2 |
base::Bind: Convert Socket::Read.
BUG=none
TEST=none
R=csilv
Review URL: http://codereview.chromium.org/8801005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_proxy_client_socket.cc | 21 | ||||
-rw-r--r-- | net/http/http_proxy_client_socket.h | 7 |
2 files changed, 25 insertions, 3 deletions
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc index 15c6e5f..ef9fb82 100644 --- a/net/http/http_proxy_client_socket.cc +++ b/net/http/http_proxy_client_socket.cc @@ -214,7 +214,26 @@ base::TimeDelta HttpProxyClientSocket::GetConnectTimeMicros() const { int HttpProxyClientSocket::Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) { - DCHECK(!old_user_callback_); + DCHECK(!old_user_callback_ && user_callback_.is_null()); + if (next_state_ != STATE_DONE) { + // We're trying to read the body of the response but we're still trying + // to establish an SSL tunnel through the proxy. We can't read these + // bytes when establishing a tunnel because they might be controlled by + // an active network attacker. We don't worry about this for HTTP + // because an active network attacker can already control HTTP sessions. + // We reach this case when the user cancels a 407 proxy auth prompt. + // See http://crbug.com/8473. + DCHECK_EQ(407, response_.headers->response_code()); + LogBlockedTunnelResponse(response_.headers->response_code()); + + return ERR_TUNNEL_CONNECTION_FAILED; + } + + return transport_->socket()->Read(buf, buf_len, callback); +} +int HttpProxyClientSocket::Read(IOBuffer* buf, int buf_len, + const CompletionCallback& callback) { + DCHECK(!old_user_callback_ && user_callback_.is_null()); if (next_state_ != STATE_DONE) { // We're trying to read the body of the response but we're still trying // to establish an SSL tunnel through the proxy. We can't read these diff --git a/net/http/http_proxy_client_socket.h b/net/http/http_proxy_client_socket.h index 15baf7c..662c305 100644 --- a/net/http/http_proxy_client_socket.h +++ b/net/http/http_proxy_client_socket.h @@ -54,7 +54,7 @@ class HttpProxyClientSocket : public ProxyClientSocket { return using_spdy_; } - // ProxyClientSocket methods: + // ProxyClientSocket implementation. virtual const HttpResponseInfo* GetConnectResponseInfo() const OVERRIDE; virtual HttpStream* CreateConnectResponseStream() OVERRIDE; virtual int RestartWithAuth(OldCompletionCallback* callback) OVERRIDE; @@ -74,10 +74,13 @@ class HttpProxyClientSocket : public ProxyClientSocket { virtual int64 NumBytesRead() const OVERRIDE; virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; - // Socket methods: + // Socket implementation. virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) OVERRIDE; + virtual int Read(IOBuffer* buf, + int buf_len, + const CompletionCallback& callback) OVERRIDE; virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) OVERRIDE; |