Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: net/http/http_network_transaction.cc

Issue 1006643002: Plumb connection attempts from (non-proxy) ConnectJobs to HttpNetworkTransaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_network_transaction.cc
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 3e9074ac30127eba6324bd74ead108b70045c6ac..9bf323d99c9a1599c3c20b28d5cf48e545af29bc 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -571,6 +571,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;
@@ -582,6 +584,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();
}
@@ -771,6 +778,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 resets the stream request first. Therefore, we have to grab the
+ // connection attempts in *that* function instead of here in that case.
+ if (result != ERR_HTTPS_PROXY_TUNNEL_RESPONSE)
+ CopyConnectionAttemptsFromStreamRequest();
+
if (result == OK) {
next_state_ = STATE_INIT_STREAM;
DCHECK(stream_.get());
@@ -1659,4 +1673,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
« no previous file with comments | « net/http/http_network_transaction.h ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698