Chromium Code Reviews| 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 OnIOComplete(ERR_SSL_CLIENT_AUTH_CERT_NEEDED); | 551 OnIOComplete(ERR_SSL_CLIENT_AUTH_CERT_NEEDED); |
| 552 } | 552 } |
| 553 | 553 |
| 554 void HttpNetworkTransaction::OnHttpsProxyTunnelResponse( | 554 void HttpNetworkTransaction::OnHttpsProxyTunnelResponse( |
| 555 const HttpResponseInfo& response_info, | 555 const HttpResponseInfo& response_info, |
| 556 const SSLConfig& used_ssl_config, | 556 const SSLConfig& used_ssl_config, |
| 557 const ProxyInfo& used_proxy_info, | 557 const ProxyInfo& used_proxy_info, |
| 558 HttpStream* stream) { | 558 HttpStream* stream) { |
| 559 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); | 559 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
| 560 | 560 |
| 561 CopyConnectionAttempts(); | |
| 562 | |
| 561 headers_valid_ = true; | 563 headers_valid_ = true; |
| 562 response_ = response_info; | 564 response_ = response_info; |
| 563 server_ssl_config_ = used_ssl_config; | 565 server_ssl_config_ = used_ssl_config; |
| 564 proxy_info_ = used_proxy_info; | 566 proxy_info_ = used_proxy_info; |
| 565 if (stream_) | 567 if (stream_) |
| 566 total_received_bytes_ += stream_->GetTotalReceivedBytes(); | 568 total_received_bytes_ += stream_->GetTotalReceivedBytes(); |
| 567 stream_.reset(stream); | 569 stream_.reset(stream); |
| 568 stream_request_.reset(); // we're done with the stream request | 570 stream_request_.reset(); // we're done with the stream request |
| 569 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); | 571 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
| 570 } | 572 } |
| 571 | 573 |
| 574 const ClientSocketHandle::ConnectionAttempts& | |
| 575 HttpNetworkTransaction::connection_attempts() const { | |
| 576 return connection_attempts_; | |
| 577 } | |
| 578 | |
| 572 bool HttpNetworkTransaction::IsSecureRequest() const { | 579 bool HttpNetworkTransaction::IsSecureRequest() const { |
| 573 return request_->url.SchemeIsSecure(); | 580 return request_->url.SchemeIsSecure(); |
| 574 } | 581 } |
| 575 | 582 |
| 576 bool HttpNetworkTransaction::UsingHttpProxyWithoutTunnel() const { | 583 bool HttpNetworkTransaction::UsingHttpProxyWithoutTunnel() const { |
| 577 return (proxy_info_.is_http() || proxy_info_.is_https() || | 584 return (proxy_info_.is_http() || proxy_info_.is_https() || |
| 578 proxy_info_.is_quic()) && | 585 proxy_info_.is_quic()) && |
| 579 !(request_->url.SchemeIs("https") || request_->url.SchemeIsWSOrWSS()); | 586 !(request_->url.SchemeIs("https") || request_->url.SchemeIsWSOrWSS()); |
| 580 } | 587 } |
| 581 | 588 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 server_ssl_config_, | 749 server_ssl_config_, |
| 743 proxy_ssl_config_, | 750 proxy_ssl_config_, |
| 744 this, | 751 this, |
| 745 net_log_)); | 752 net_log_)); |
| 746 } | 753 } |
| 747 DCHECK(stream_request_.get()); | 754 DCHECK(stream_request_.get()); |
| 748 return ERR_IO_PENDING; | 755 return ERR_IO_PENDING; |
| 749 } | 756 } |
| 750 | 757 |
| 751 int HttpNetworkTransaction::DoCreateStreamComplete(int result) { | 758 int HttpNetworkTransaction::DoCreateStreamComplete(int result) { |
| 759 CopyConnectionAttempts(); | |
|
Ryan Hamilton
2015/03/17 03:22:28
Is it clear that these are the only places this me
Deprecated (see juliatuttle)
2015/03/23 17:45:35
It was clear to me when I wrote it; I looked for p
| |
| 760 | |
| 752 if (result == OK) { | 761 if (result == OK) { |
| 753 next_state_ = STATE_INIT_STREAM; | 762 next_state_ = STATE_INIT_STREAM; |
| 754 DCHECK(stream_.get()); | 763 DCHECK(stream_.get()); |
| 755 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 764 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
| 756 result = HandleCertificateRequest(result); | 765 result = HandleCertificateRequest(result); |
| 757 } else if (result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { | 766 } else if (result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { |
| 758 // Return OK and let the caller read the proxy's error page | 767 // Return OK and let the caller read the proxy's error page |
| 759 next_state_ = STATE_NONE; | 768 next_state_ = STATE_NONE; |
| 760 return OK; | 769 return OK; |
| 761 } else if (result == ERR_HTTP_1_1_REQUIRED || | 770 } else if (result == ERR_HTTP_1_1_REQUIRED || |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1533 default: | 1542 default: |
| 1534 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1543 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 1535 state); | 1544 state); |
| 1536 break; | 1545 break; |
| 1537 } | 1546 } |
| 1538 return description; | 1547 return description; |
| 1539 } | 1548 } |
| 1540 | 1549 |
| 1541 #undef STATE_CASE | 1550 #undef STATE_CASE |
| 1542 | 1551 |
| 1552 void HttpNetworkTransaction::CopyConnectionAttempts() { | |
| 1553 DCHECK(stream_request_); | |
| 1554 | |
| 1555 for (const auto& attempt : stream_request_->connection_attempts()) | |
| 1556 connection_attempts_.push_back(attempt); | |
|
Ryan Hamilton
2015/03/17 03:22:28
Could you simply do connection_attempts_ = stream_
Deprecated (see juliatuttle)
2015/03/23 17:45:35
Can we not restart the request with auth data? I w
Ryan Hamilton
2015/03/24 19:20:19
Oh, are you explicitly attempting to append and no
| |
| 1557 } | |
| 1558 | |
| 1543 } // namespace net | 1559 } // namespace net |
| OLD | NEW |