| 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_stream_factory_impl_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // stream. | 138 // stream. |
| 139 std::unique_ptr<base::Value> NetLogHttpStreamProtoCallback( | 139 std::unique_ptr<base::Value> NetLogHttpStreamProtoCallback( |
| 140 NextProto negotiated_protocol, | 140 NextProto negotiated_protocol, |
| 141 NetLogCaptureMode /* capture_mode */) { | 141 NetLogCaptureMode /* capture_mode */) { |
| 142 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 142 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 143 | 143 |
| 144 dict->SetString("proto", NextProtoToString(negotiated_protocol)); | 144 dict->SetString("proto", NextProtoToString(negotiated_protocol)); |
| 145 return std::move(dict); | 145 return std::move(dict); |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Returns parameters associated with the proxy resolution. |
| 149 std::unique_ptr<base::Value> NetLogHttpStreamJobProxyServerResolved( |
| 150 const ProxyServer& proxy_server, |
| 151 NetLogCaptureMode /* capture_mode */) { |
| 152 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 153 |
| 154 dict->SetString("proxy_server", proxy_server.is_valid() |
| 155 ? proxy_server.ToPacString() |
| 156 : std::string()); |
| 157 return std::move(dict); |
| 158 } |
| 159 |
| 148 HttpStreamFactoryImpl::Job::Job(Delegate* delegate, | 160 HttpStreamFactoryImpl::Job::Job(Delegate* delegate, |
| 149 JobType job_type, | 161 JobType job_type, |
| 150 HttpNetworkSession* session, | 162 HttpNetworkSession* session, |
| 151 const HttpRequestInfo& request_info, | 163 const HttpRequestInfo& request_info, |
| 152 RequestPriority priority, | 164 RequestPriority priority, |
| 153 const SSLConfig& server_ssl_config, | 165 const SSLConfig& server_ssl_config, |
| 154 const SSLConfig& proxy_ssl_config, | 166 const SSLConfig& proxy_ssl_config, |
| 155 HostPortPair destination, | 167 HostPortPair destination, |
| 156 GURL origin_url, | 168 GURL origin_url, |
| 157 NetLog* net_log) | 169 NetLog* net_log) |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 } | 744 } |
| 733 | 745 |
| 734 return session_->proxy_service()->ResolveProxy( | 746 return session_->proxy_service()->ResolveProxy( |
| 735 origin_url_, request_info_.method, &proxy_info_, io_callback_, | 747 origin_url_, request_info_.method, &proxy_info_, io_callback_, |
| 736 &pac_request_, session_->params().proxy_delegate, net_log_); | 748 &pac_request_, session_->params().proxy_delegate, net_log_); |
| 737 } | 749 } |
| 738 | 750 |
| 739 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { | 751 int HttpStreamFactoryImpl::Job::DoResolveProxyComplete(int result) { |
| 740 pac_request_ = NULL; | 752 pac_request_ = NULL; |
| 741 | 753 |
| 754 net_log_.AddEvent( |
| 755 NetLogEventType::HTTP_STREAM_JOB_PROXY_SERVER_RESOLVED, |
| 756 base::Bind( |
| 757 &NetLogHttpStreamJobProxyServerResolved, |
| 758 proxy_info_.is_empty() ? ProxyServer() : proxy_info_.proxy_server())); |
| 759 |
| 742 if (result == OK) { | 760 if (result == OK) { |
| 743 // Remove unsupported proxies from the list. | 761 // Remove unsupported proxies from the list. |
| 744 int supported_proxies = | 762 int supported_proxies = |
| 745 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | | 763 ProxyServer::SCHEME_DIRECT | ProxyServer::SCHEME_HTTP | |
| 746 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | | 764 ProxyServer::SCHEME_HTTPS | ProxyServer::SCHEME_SOCKS4 | |
| 747 ProxyServer::SCHEME_SOCKS5; | 765 ProxyServer::SCHEME_SOCKS5; |
| 748 | 766 |
| 749 if (session_->IsQuicEnabled()) | 767 if (session_->IsQuicEnabled()) |
| 750 supported_proxies |= ProxyServer::SCHEME_QUIC; | 768 supported_proxies |= ProxyServer::SCHEME_QUIC; |
| 751 | 769 |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 | 1532 |
| 1515 ConnectionAttempts socket_attempts = connection_->connection_attempts(); | 1533 ConnectionAttempts socket_attempts = connection_->connection_attempts(); |
| 1516 if (connection_->socket()) { | 1534 if (connection_->socket()) { |
| 1517 connection_->socket()->GetConnectionAttempts(&socket_attempts); | 1535 connection_->socket()->GetConnectionAttempts(&socket_attempts); |
| 1518 } | 1536 } |
| 1519 | 1537 |
| 1520 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); | 1538 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); |
| 1521 } | 1539 } |
| 1522 | 1540 |
| 1523 } // namespace net | 1541 } // namespace net |
| OLD | NEW |