Chromium Code Reviews| Index: net/http/http_network_transaction.cc |
| =================================================================== |
| --- net/http/http_network_transaction.cc (revision 68026) |
| +++ net/http/http_network_transaction.cc (working copy) |
| @@ -283,13 +283,16 @@ |
| State next_state = STATE_NONE; |
| scoped_refptr<HttpResponseHeaders> headers(GetResponseHeaders()); |
| - if (headers_valid_ && headers.get() && stream_request_.get()) { |
| + if (headers_valid_ && headers.get() && stream_request_.get() && |
| + !stream_.get()) { |
|
vandebo (ex-Chrome)
2010/12/14 00:30:23
This seems to make the conditional a bit more frag
Ryan Hamilton
2010/12/15 20:14:17
Looks like a cleaner alternative is to simply rese
|
| // 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 |
| + // to establish an SSL tunnel through an HTTP 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. |
| + // We reach this case when the user cancels a 407 proxy auth prompt. We |
| + // also don't worry about this for an HTTPS Proxy, because the |
| + // communication with the proxy is secure. |
| // See http://crbug.com/8473. |
| DCHECK(proxy_info_.is_http() || proxy_info_.is_https()); |
| DCHECK_EQ(headers->response_code(), 407); |
| @@ -301,7 +304,6 @@ |
| // Are we using SPDY or HTTP? |
| next_state = STATE_READ_BODY; |
| - DCHECK(stream_->GetResponseInfo()->headers); |
| read_buf_ = buf; |
| read_buf_len_ = buf_len; |
| @@ -410,6 +412,17 @@ |
| OnIOComplete(ERR_SSL_CLIENT_AUTH_CERT_NEEDED); |
| } |
| +void HttpNetworkTransaction::OnHttpsProxyTunnelConnectionResponse( |
| + const HttpResponseInfo& response_info, |
| + HttpStream* stream) { |
| + DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
| + |
| + headers_valid_ = true; |
| + response_ = response_info; |
| + stream_.reset(stream); |
| + OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE); |
| +} |
| + |
| bool HttpNetworkTransaction::is_https_request() const { |
| return request_->url.SchemeIs("https"); |
| } |
| @@ -535,6 +548,10 @@ |
| DCHECK(stream_.get()); |
| } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
| result = HandleCertificateRequest(result); |
| + } else if (result == ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE) { |
| + // Return OK and let the caller read the proxy's error page |
| + next_state_ = STATE_NONE; |
| + return OK; |
| } |
| // At this point we are done with the stream_request_. |