OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const std::string url_; | 58 const std::string url_; |
59 }; | 59 }; |
60 | 60 |
61 Value* HttpStreamJobParameters::ToValue() const { | 61 Value* HttpStreamJobParameters::ToValue() const { |
62 DictionaryValue* dict = new DictionaryValue(); | 62 DictionaryValue* dict = new DictionaryValue(); |
63 dict->SetString("original_url", original_url_); | 63 dict->SetString("original_url", original_url_); |
64 dict->SetString("url", url_); | 64 dict->SetString("url", url_); |
65 return dict; | 65 return dict; |
66 } | 66 } |
67 | 67 |
| 68 // Parameters associated with the Proto (with NPN negotiation) of a HTTP stream. |
| 69 class HttpStreamProtoParameters : public NetLog::EventParameters { |
| 70 public: |
| 71 static scoped_refptr<HttpStreamProtoParameters> Create( |
| 72 const SSLClientSocket::NextProtoStatus status, |
| 73 const std::string& proto, |
| 74 const std::string& server_protos) { |
| 75 return make_scoped_refptr(new HttpStreamProtoParameters( |
| 76 status, proto, server_protos)); |
| 77 } |
| 78 |
| 79 virtual Value* ToValue() const; |
| 80 |
| 81 private: |
| 82 HttpStreamProtoParameters(const SSLClientSocket::NextProtoStatus status, |
| 83 const std::string& proto, |
| 84 const std::string& server_protos) |
| 85 : status_(status), |
| 86 proto_(proto), |
| 87 server_protos_(server_protos) {} |
| 88 |
| 89 const SSLClientSocket::NextProtoStatus status_; |
| 90 const std::string proto_; |
| 91 const std::string server_protos_; |
| 92 }; |
| 93 |
| 94 Value* HttpStreamProtoParameters::ToValue() const { |
| 95 DictionaryValue* dict = new DictionaryValue(); |
| 96 |
| 97 dict->SetString("next_proto_status", |
| 98 SSLClientSocket::NextProtoStatusToString(status_)); |
| 99 dict->SetString("proto", proto_); |
| 100 dict->SetString("server_protos", |
| 101 SSLClientSocket::ServerProtosToString(server_protos_)); |
| 102 return dict; |
| 103 } |
| 104 |
68 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, | 105 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, |
69 HttpNetworkSession* session, | 106 HttpNetworkSession* session, |
70 const HttpRequestInfo& request_info, | 107 const HttpRequestInfo& request_info, |
71 const SSLConfig& server_ssl_config, | 108 const SSLConfig& server_ssl_config, |
72 const SSLConfig& proxy_ssl_config, | 109 const SSLConfig& proxy_ssl_config, |
73 const BoundNetLog& net_log) | 110 const BoundNetLog& net_log) |
74 : request_(NULL), | 111 : request_(NULL), |
75 request_info_(request_info), | 112 request_info_(request_info), |
76 server_ssl_config_(server_ssl_config), | 113 server_ssl_config_(server_ssl_config), |
77 proxy_ssl_config_(proxy_ssl_config), | 114 proxy_ssl_config_(proxy_ssl_config), |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 // then the SSL handshake ran with an unrecoverable error. | 741 // then the SSL handshake ran with an unrecoverable error. |
705 // otherwise, the error came from one of the other pools. | 742 // otherwise, the error came from one of the other pools. |
706 bool ssl_started = using_ssl_ && (result == OK || connection_->socket() || | 743 bool ssl_started = using_ssl_ && (result == OK || connection_->socket() || |
707 connection_->is_ssl_error()); | 744 connection_->is_ssl_error()); |
708 | 745 |
709 if (ssl_started && (result == OK || IsCertificateError(result))) { | 746 if (ssl_started && (result == OK || IsCertificateError(result))) { |
710 SSLClientSocket* ssl_socket = | 747 SSLClientSocket* ssl_socket = |
711 static_cast<SSLClientSocket*>(connection_->socket()); | 748 static_cast<SSLClientSocket*>(connection_->socket()); |
712 if (ssl_socket->was_npn_negotiated()) { | 749 if (ssl_socket->was_npn_negotiated()) { |
713 was_npn_negotiated_ = true; | 750 was_npn_negotiated_ = true; |
| 751 std::string proto; |
| 752 std::string server_protos; |
| 753 SSLClientSocket::NextProtoStatus status = |
| 754 ssl_socket->GetNextProto(&proto, &server_protos); |
| 755 net_log_.AddEvent( |
| 756 NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO, |
| 757 HttpStreamProtoParameters::Create(status, proto, server_protos)); |
714 if (ssl_socket->was_spdy_negotiated()) | 758 if (ssl_socket->was_spdy_negotiated()) |
715 SwitchToSpdyMode(); | 759 SwitchToSpdyMode(); |
716 } | 760 } |
717 if (ShouldForceSpdySSL()) | 761 if (ShouldForceSpdySSL()) |
718 SwitchToSpdyMode(); | 762 SwitchToSpdyMode(); |
719 } else if (proxy_info_.is_https() && connection_->socket() && | 763 } else if (proxy_info_.is_https() && connection_->socket() && |
720 result == OK) { | 764 result == OK) { |
721 HttpProxyClientSocket* proxy_socket = | 765 HttpProxyClientSocket* proxy_socket = |
722 static_cast<HttpProxyClientSocket*>(connection_->socket()); | 766 static_cast<HttpProxyClientSocket*>(connection_->socket()); |
723 if (proxy_socket->using_spdy()) { | 767 if (proxy_socket->using_spdy()) { |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 return false; | 1192 return false; |
1149 } | 1193 } |
1150 if (request_info_.method != "GET" && request_info_.method != "HEAD") { | 1194 if (request_info_.method != "GET" && request_info_.method != "HEAD") { |
1151 return false; | 1195 return false; |
1152 } | 1196 } |
1153 return stream_factory_->http_pipelined_host_pool_.IsHostEligibleForPipelining( | 1197 return stream_factory_->http_pipelined_host_pool_.IsHostEligibleForPipelining( |
1154 origin_); | 1198 origin_); |
1155 } | 1199 } |
1156 | 1200 |
1157 } // namespace net | 1201 } // namespace net |
OLD | NEW |