Chromium Code Reviews| Index: net/http/http_network_transaction.cc |
| diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc |
| index b5e5d5c1a24efb6ea8b784f93c53f49c65fae882..8e7fc7c5191570b4493a07530042dce91c486f0a 100644 |
| --- a/net/http/http_network_transaction.cc |
| +++ b/net/http/http_network_transaction.cc |
| @@ -570,6 +570,8 @@ void HttpNetworkTransaction::OnHttpsProxyTunnelResponse( |
| HttpStream* stream) { |
| DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
| + CopyConnectionAttemptsFromStreamRequest(); |
| + |
| headers_valid_ = true; |
| response_ = response_info; |
| server_ssl_config_ = used_ssl_config; |
| @@ -581,6 +583,11 @@ void HttpNetworkTransaction::OnHttpsProxyTunnelResponse( |
| OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
| } |
| +void HttpNetworkTransaction::GetConnectionAttempts( |
| + ConnectionAttempts* out) const { |
| + *out = connection_attempts_; |
| +} |
| + |
| bool HttpNetworkTransaction::IsSecureRequest() const { |
| return request_->url.SchemeIsSecure(); |
| } |
| @@ -770,6 +777,13 @@ int HttpNetworkTransaction::DoCreateStreamComplete(int result) { |
| FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| "424359 HttpNetworkTransaction::DoCreateStreamComplete")); |
| + // If |result| is ERR_HTTPS_PROXY_TUNNEL_RESPONSE, then |
| + // DoCreateStreamComplete is being called from OnHttpsProxyTunnelResponse, |
| + // which will have already copied connection attempts and reset the stream |
| + // request, so don't try to do it again here. |
|
Randy Smith (Not in Mondays)
2015/04/23 19:04:09
Also mention (here or in OnHttpsProxyTunnelRespons
Deprecated (see juliatuttle)
2015/04/23 21:04:16
Done.
|
| + if (result != ERR_HTTPS_PROXY_TUNNEL_RESPONSE) |
| + CopyConnectionAttemptsFromStreamRequest(); |
| + |
| if (result == OK) { |
| next_state_ = STATE_INIT_STREAM; |
| DCHECK(stream_.get()); |
| @@ -1658,4 +1672,14 @@ std::string HttpNetworkTransaction::DescribeState(State state) { |
| #undef STATE_CASE |
| +void HttpNetworkTransaction::CopyConnectionAttemptsFromStreamRequest() { |
| + DCHECK(stream_request_); |
| + |
| + // Since the transaction can restart with auth credentials, it may create a |
| + // stream more than once. Accumulate all of the connection attempts across |
| + // those streams by appending them to the vector: |
| + for (const auto& attempt : stream_request_->connection_attempts()) |
| + connection_attempts_.push_back(attempt); |
| +} |
| + |
| } // namespace net |