Index: net/http/http_proxy_client_socket.cc |
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc |
index 3d9eadd48353eaa61095581bcc22034e3e510e7f..e3c44bc2e58900746e2ca444566c588091d43da8 100644 |
--- a/net/http/http_proxy_client_socket.cc |
+++ b/net/http/http_proxy_client_socket.cc |
@@ -41,13 +41,13 @@ HttpProxyClientSocket::HttpProxyClientSocket( |
next_state_(STATE_NONE), |
transport_(transport_socket), |
endpoint_(endpoint), |
- auth_(tunnel ? |
- new HttpAuthController(HttpAuth::AUTH_PROXY, |
- GURL((is_https_proxy ? "https://" : "http://") |
- + proxy_server.ToString()), |
- http_auth_cache, |
- http_auth_handler_factory) |
- : NULL), |
+ auth_(tunnel ? new HttpAuthController( |
+ HttpAuth::AUTH_PROXY, |
+ GURL((is_https_proxy ? "https://" : "http://") + |
+ proxy_server.ToString()), |
+ http_auth_cache, |
+ http_auth_handler_factory) |
+ : NULL), |
tunnel_(tunnel), |
using_spdy_(using_spdy), |
protocol_negotiated_(protocol_negotiated), |
@@ -77,7 +77,7 @@ int HttpProxyClientSocket::RestartWithAuth(const CompletionCallback& callback) { |
rv = DoLoop(OK); |
if (rv == ERR_IO_PENDING) { |
if (!callback.is_null()) |
- user_callback_ = callback; |
+ user_callback_ = callback; |
} |
return rv; |
@@ -105,7 +105,6 @@ HttpStream* HttpProxyClientSocket::CreateConnectResponseStream() { |
redirect_has_load_timing_info_ ? &redirect_load_timing_info_ : NULL); |
} |
- |
int HttpProxyClientSocket::Connect(const CompletionCallback& callback) { |
DCHECK(transport_.get()); |
DCHECK(transport_->socket()); |
@@ -146,7 +145,7 @@ bool HttpProxyClientSocket::IsConnected() const { |
bool HttpProxyClientSocket::IsConnectedAndIdle() const { |
return next_state_ == STATE_DONE && |
- transport_->socket()->IsConnectedAndIdle(); |
+ transport_->socket()->IsConnectedAndIdle(); |
} |
const BoundNetLog& HttpProxyClientSocket::NetLog() const { |
@@ -209,7 +208,8 @@ bool HttpProxyClientSocket::GetSSLInfo(SSLInfo* ssl_info) { |
return false; |
} |
-int HttpProxyClientSocket::Read(IOBuffer* buf, int buf_len, |
+int HttpProxyClientSocket::Read(IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback) { |
DCHECK(user_callback_.is_null()); |
if (next_state_ != STATE_DONE) { |
@@ -229,7 +229,8 @@ int HttpProxyClientSocket::Read(IOBuffer* buf, int buf_len, |
return transport_->socket()->Read(buf, buf_len, callback); |
} |
-int HttpProxyClientSocket::Write(IOBuffer* buf, int buf_len, |
+int HttpProxyClientSocket::Write(IOBuffer* buf, |
+ int buf_len, |
const CompletionCallback& callback) { |
DCHECK_EQ(STATE_DONE, next_state_); |
DCHECK(user_callback_.is_null()); |
@@ -296,9 +297,7 @@ int HttpProxyClientSocket::DidDrainBodyForAuthRestart(bool keep_alive) { |
void HttpProxyClientSocket::LogBlockedTunnelResponse() const { |
ProxyClientSocket::LogBlockedTunnelResponse( |
- response_.headers->response_code(), |
- request_.url, |
- is_https_proxy_); |
+ response_.headers->response_code(), request_.url, is_https_proxy_); |
} |
void HttpProxyClientSocket::DoCallback(int result) { |
@@ -337,8 +336,7 @@ int HttpProxyClientSocket::DoLoop(int last_io_result) { |
break; |
case STATE_SEND_REQUEST: |
DCHECK_EQ(OK, rv); |
- net_log_.BeginEvent( |
- NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST); |
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST); |
rv = DoSendRequest(); |
break; |
case STATE_SEND_REQUEST_COMPLETE: |
@@ -348,8 +346,7 @@ int HttpProxyClientSocket::DoLoop(int last_io_result) { |
break; |
case STATE_READ_HEADERS: |
DCHECK_EQ(OK, rv); |
- net_log_.BeginEvent( |
- NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS); |
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS); |
rv = DoReadHeaders(); |
break; |
case STATE_READ_HEADERS_COMPLETE: |
@@ -405,14 +402,16 @@ int HttpProxyClientSocket::DoSendRequest() { |
HttpRequestHeaders authorization_headers; |
if (auth_->HaveAuth()) |
auth_->AddAuthorizationHeader(&authorization_headers); |
- BuildTunnelRequest(request_, authorization_headers, endpoint_, |
- &request_line_, &request_headers_); |
- |
- net_log_.AddEvent( |
- NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
- base::Bind(&HttpRequestHeaders::NetLogCallback, |
- base::Unretained(&request_headers_), |
- &request_line_)); |
+ BuildTunnelRequest(request_, |
+ authorization_headers, |
+ endpoint_, |
+ &request_line_, |
+ &request_headers_); |
+ |
+ net_log_.AddEvent(NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
+ base::Bind(&HttpRequestHeaders::NetLogCallback, |
+ base::Unretained(&request_headers_), |
+ &request_line_)); |
} |
parser_buf_ = new GrowableIOBuffer(); |
@@ -456,12 +455,12 @@ int HttpProxyClientSocket::DoReadHeadersComplete(int result) { |
next_state_ = STATE_DONE; |
return OK; |
- // We aren't able to CONNECT to the remote host through the proxy. We |
- // need to be very suspicious about the response because an active network |
- // attacker can force us into this state by masquerading as the proxy. |
- // The only safe thing to do here is to fail the connection because our |
- // client is expecting an SSL protected response. |
- // See http://crbug.com/7338. |
+ // We aren't able to CONNECT to the remote host through the proxy. We |
+ // need to be very suspicious about the response because an active network |
+ // attacker can force us into this state by masquerading as the proxy. |
+ // The only safe thing to do here is to fail the connection because our |
+ // client is expecting an SSL protected response. |
+ // See http://crbug.com/7338. |
case 302: // Found / Moved Temporarily |
// Attempt to follow redirects from HTTPS proxies, but only if we can |
@@ -470,9 +469,8 @@ int HttpProxyClientSocket::DoReadHeadersComplete(int result) { |
// allows it to impersonate the site the user requested. |
if (is_https_proxy_ && SanitizeProxyRedirect(&response_, request_.url)) { |
bool is_connection_reused = http_stream_parser_->IsConnectionReused(); |
- redirect_has_load_timing_info_ = |
- transport_->GetLoadTimingInfo( |
- is_connection_reused, &redirect_load_timing_info_); |
+ redirect_has_load_timing_info_ = transport_->GetLoadTimingInfo( |
+ is_connection_reused, &redirect_load_timing_info_); |
transport_.reset(); |
http_stream_parser_.reset(); |
return ERR_HTTPS_PROXY_TUNNEL_RESPONSE; |