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

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 8676046: Log server advertised protos (NPN data to NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/socket/ssl_client_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 return make_scoped_refptr(new HttpStreamProtoParameters(status, proto));
75 }
76
77 virtual Value* ToValue() const;
78
79 private:
80 HttpStreamProtoParameters(const SSLClientSocket::NextProtoStatus status,
81 const std::string& proto)
82 : status_(status),
83 proto_(proto) {}
84
85 const SSLClientSocket::NextProtoStatus status_;
86 const std::string proto_;
87 };
88
89 Value* HttpStreamProtoParameters::ToValue() const {
90 DictionaryValue* dict = new DictionaryValue();
91
92 dict->SetString("next_proto_status",
93 SSLClientSocket::NextProtoStatusToString(status_));
94 dict->SetString("proto", proto_);
95 return dict;
96 }
97
68 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, 98 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory,
69 HttpNetworkSession* session, 99 HttpNetworkSession* session,
70 const HttpRequestInfo& request_info, 100 const HttpRequestInfo& request_info,
71 const SSLConfig& server_ssl_config, 101 const SSLConfig& server_ssl_config,
72 const SSLConfig& proxy_ssl_config, 102 const SSLConfig& proxy_ssl_config,
73 const BoundNetLog& net_log) 103 const BoundNetLog& net_log)
74 : request_(NULL), 104 : request_(NULL),
75 request_info_(request_info), 105 request_info_(request_info),
76 server_ssl_config_(server_ssl_config), 106 server_ssl_config_(server_ssl_config),
77 proxy_ssl_config_(proxy_ssl_config), 107 proxy_ssl_config_(proxy_ssl_config),
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 // then the SSL handshake ran with an unrecoverable error. 734 // then the SSL handshake ran with an unrecoverable error.
705 // otherwise, the error came from one of the other pools. 735 // otherwise, the error came from one of the other pools.
706 bool ssl_started = using_ssl_ && (result == OK || connection_->socket() || 736 bool ssl_started = using_ssl_ && (result == OK || connection_->socket() ||
707 connection_->is_ssl_error()); 737 connection_->is_ssl_error());
708 738
709 if (ssl_started && (result == OK || IsCertificateError(result))) { 739 if (ssl_started && (result == OK || IsCertificateError(result))) {
710 SSLClientSocket* ssl_socket = 740 SSLClientSocket* ssl_socket =
711 static_cast<SSLClientSocket*>(connection_->socket()); 741 static_cast<SSLClientSocket*>(connection_->socket());
712 if (ssl_socket->was_npn_negotiated()) { 742 if (ssl_socket->was_npn_negotiated()) {
713 was_npn_negotiated_ = true; 743 was_npn_negotiated_ = true;
744 std::string proto;
745 SSLClientSocket::NextProtoStatus status =
746 ssl_socket->GetNextProto(&proto);
747 net_log_.AddEvent(NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO,
748 HttpStreamProtoParameters::Create(status, proto));
714 if (ssl_socket->was_spdy_negotiated()) 749 if (ssl_socket->was_spdy_negotiated())
715 SwitchToSpdyMode(); 750 SwitchToSpdyMode();
716 } 751 }
717 if (ShouldForceSpdySSL()) 752 if (ShouldForceSpdySSL())
718 SwitchToSpdyMode(); 753 SwitchToSpdyMode();
719 } else if (proxy_info_.is_https() && connection_->socket() && 754 } else if (proxy_info_.is_https() && connection_->socket() &&
720 result == OK) { 755 result == OK) {
721 HttpProxyClientSocket* proxy_socket = 756 HttpProxyClientSocket* proxy_socket =
722 static_cast<HttpProxyClientSocket*>(connection_->socket()); 757 static_cast<HttpProxyClientSocket*>(connection_->socket());
723 if (proxy_socket->using_spdy()) { 758 if (proxy_socket->using_spdy()) {
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 if (IsPreconnecting() || !request_) { 1179 if (IsPreconnecting() || !request_) {
1145 return false; 1180 return false;
1146 } 1181 }
1147 if (using_ssl_) { 1182 if (using_ssl_) {
1148 return false; 1183 return false;
1149 } 1184 }
1150 return request_info_.method == "GET" || request_info_.method == "HEAD"; 1185 return request_info_.method == "GET" || request_info_.method == "HEAD";
1151 } 1186 }
1152 1187
1153 } // namespace net 1188 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_log_event_type_list.h ('k') | net/socket/ssl_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698