OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
563 OnIOComplete(ERR_SSL_CLIENT_AUTH_CERT_NEEDED); | 563 OnIOComplete(ERR_SSL_CLIENT_AUTH_CERT_NEEDED); |
564 } | 564 } |
565 | 565 |
566 void HttpNetworkTransaction::OnHttpsProxyTunnelResponse( | 566 void HttpNetworkTransaction::OnHttpsProxyTunnelResponse( |
567 const HttpResponseInfo& response_info, | 567 const HttpResponseInfo& response_info, |
568 const SSLConfig& used_ssl_config, | 568 const SSLConfig& used_ssl_config, |
569 const ProxyInfo& used_proxy_info, | 569 const ProxyInfo& used_proxy_info, |
570 HttpStream* stream) { | 570 HttpStream* stream) { |
571 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); | 571 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
572 | 572 |
573 CopyConnectionAttempts(); | |
574 | |
573 headers_valid_ = true; | 575 headers_valid_ = true; |
574 response_ = response_info; | 576 response_ = response_info; |
575 server_ssl_config_ = used_ssl_config; | 577 server_ssl_config_ = used_ssl_config; |
576 proxy_info_ = used_proxy_info; | 578 proxy_info_ = used_proxy_info; |
577 if (stream_) | 579 if (stream_) |
578 total_received_bytes_ += stream_->GetTotalReceivedBytes(); | 580 total_received_bytes_ += stream_->GetTotalReceivedBytes(); |
579 stream_.reset(stream); | 581 stream_.reset(stream); |
580 stream_request_.reset(); // we're done with the stream request | 582 stream_request_.reset(); // we're done with the stream request |
581 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); | 583 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
582 } | 584 } |
583 | 585 |
586 const ConnectionAttempts& HttpNetworkTransaction::connection_attempts() const { | |
587 return connection_attempts_; | |
588 } | |
589 | |
584 bool HttpNetworkTransaction::IsSecureRequest() const { | 590 bool HttpNetworkTransaction::IsSecureRequest() const { |
585 return request_->url.SchemeIsSecure(); | 591 return request_->url.SchemeIsSecure(); |
586 } | 592 } |
587 | 593 |
588 bool HttpNetworkTransaction::UsingHttpProxyWithoutTunnel() const { | 594 bool HttpNetworkTransaction::UsingHttpProxyWithoutTunnel() const { |
589 return (proxy_info_.is_http() || proxy_info_.is_https() || | 595 return (proxy_info_.is_http() || proxy_info_.is_https() || |
590 proxy_info_.is_quic()) && | 596 proxy_info_.is_quic()) && |
591 !(request_->url.SchemeIs("https") || request_->url.SchemeIsWSOrWSS()); | 597 !(request_->url.SchemeIs("https") || request_->url.SchemeIsWSOrWSS()); |
592 } | 598 } |
593 | 599 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 server_ssl_config_, | 760 server_ssl_config_, |
755 proxy_ssl_config_, | 761 proxy_ssl_config_, |
756 this, | 762 this, |
757 net_log_)); | 763 net_log_)); |
758 } | 764 } |
759 DCHECK(stream_request_.get()); | 765 DCHECK(stream_request_.get()); |
760 return ERR_IO_PENDING; | 766 return ERR_IO_PENDING; |
761 } | 767 } |
762 | 768 |
763 int HttpNetworkTransaction::DoCreateStreamComplete(int result) { | 769 int HttpNetworkTransaction::DoCreateStreamComplete(int result) { |
770 if (result != ERR_HTTPS_PROXY_TUNNEL_RESPONSE) | |
Randy Smith (Not in Mondays)
2015/04/10 21:15:03
Willing to educate me about why a proxy tunnel res
Deprecated (see juliatuttle)
2015/04/14 19:14:45
Yes: we reset stream_request_ in OnHttpsProxyTunne
Randy Smith (Not in Mondays)
2015/04/15 20:19:07
Yes, please. (If it were arcana about tunneling i
| |
771 CopyConnectionAttempts(); | |
772 | |
764 if (result == OK) { | 773 if (result == OK) { |
765 next_state_ = STATE_INIT_STREAM; | 774 next_state_ = STATE_INIT_STREAM; |
766 DCHECK(stream_.get()); | 775 DCHECK(stream_.get()); |
767 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 776 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
768 result = HandleCertificateRequest(result); | 777 result = HandleCertificateRequest(result); |
769 } else if (result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { | 778 } else if (result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { |
770 // Return OK and let the caller read the proxy's error page | 779 // Return OK and let the caller read the proxy's error page |
771 next_state_ = STATE_NONE; | 780 next_state_ = STATE_NONE; |
772 return OK; | 781 return OK; |
773 } else if (result == ERR_HTTP_1_1_REQUIRED || | 782 } else if (result == ERR_HTTP_1_1_REQUIRED || |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1552 default: | 1561 default: |
1553 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1562 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1554 state); | 1563 state); |
1555 break; | 1564 break; |
1556 } | 1565 } |
1557 return description; | 1566 return description; |
1558 } | 1567 } |
1559 | 1568 |
1560 #undef STATE_CASE | 1569 #undef STATE_CASE |
1561 | 1570 |
1571 void HttpNetworkTransaction::CopyConnectionAttempts() { | |
1572 DCHECK(stream_request_); | |
1573 | |
1574 // Since the transaction can restart with auth credentials, it may create a | |
1575 // stream more than once. Accumulate all of the connection attempts across | |
1576 // those streams by appending them to the vector: | |
1577 for (const auto& attempt : stream_request_->connection_attempts()) | |
1578 connection_attempts_.push_back(attempt); | |
1579 } | |
1580 | |
1562 } // namespace net | 1581 } // namespace net |
OLD | NEW |