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

Side by Side Diff: net/socket/ssl_client_socket.cc

Issue 8787011: Log server advertised protos and the selected (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/socket/ssl_client_socket.h ('k') | net/socket/ssl_client_socket_mac.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) 2010 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/socket/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "base/string_util.h"
8
7 namespace net { 9 namespace net {
8 10
9 SSLClientSocket::SSLClientSocket() 11 SSLClientSocket::SSLClientSocket()
10 : was_npn_negotiated_(false), 12 : was_npn_negotiated_(false),
11 was_spdy_negotiated_(false) { 13 was_spdy_negotiated_(false) {
12 } 14 }
13 15
14 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString( 16 SSLClientSocket::NextProto SSLClientSocket::NextProtoFromString(
15 const std::string& proto_string) { 17 const std::string& proto_string) {
16 if (proto_string == "http1.1" || proto_string == "http/1.1") { 18 if (proto_string == "http1.1" || proto_string == "http/1.1") {
17 return kProtoHTTP11; 19 return kProtoHTTP11;
18 } else if (proto_string == "spdy/1") { 20 } else if (proto_string == "spdy/1") {
19 return kProtoSPDY1; 21 return kProtoSPDY1;
20 } else if (proto_string == "spdy/2") { 22 } else if (proto_string == "spdy/2") {
21 return kProtoSPDY2; 23 return kProtoSPDY2;
22 } else { 24 } else {
23 return kProtoUnknown; 25 return kProtoUnknown;
24 } 26 }
25 } 27 }
26 28
29 // static
30 const char* SSLClientSocket::NextProtoStatusToString(
31 const SSLClientSocket::NextProtoStatus status) {
32 switch (status) {
33 case kNextProtoUnsupported:
34 return "unsupported";
35 case kNextProtoNegotiated:
36 return "negotiated";
37 case kNextProtoNoOverlap:
38 return "no-overlap";
39 }
40 return NULL;
41 }
42
43 // static
44 std::string SSLClientSocket::ServerProtosToString(
45 const std::string& server_protos) {
46 const char* protos = server_protos.c_str();
47 size_t protos_len = server_protos.length();
48 std::vector<std::string> server_protos_with_commas;
49 for (size_t i = 0; i < protos_len; ) {
50 const size_t len = protos[i];
51 std::string proto_str(&protos[i + 1], len);
52 server_protos_with_commas.push_back(proto_str);
53 i += len + 1;
54 }
55 return JoinString(server_protos_with_commas, ',');
56 }
57
27 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) { 58 bool SSLClientSocket::IgnoreCertError(int error, int load_flags) {
28 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS) 59 if (error == OK || load_flags & LOAD_IGNORE_ALL_CERT_ERRORS)
29 return true; 60 return true;
30 61
31 if (error == ERR_CERT_COMMON_NAME_INVALID && 62 if (error == ERR_CERT_COMMON_NAME_INVALID &&
32 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID)) 63 (load_flags & LOAD_IGNORE_CERT_COMMON_NAME_INVALID))
33 return true; 64 return true;
34 65
35 if (error == ERR_CERT_DATE_INVALID && 66 if (error == ERR_CERT_DATE_INVALID &&
36 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID)) 67 (load_flags & LOAD_IGNORE_CERT_DATE_INVALID))
(...skipping 16 matching lines...) Expand all
53 84
54 bool SSLClientSocket::was_spdy_negotiated() const { 85 bool SSLClientSocket::was_spdy_negotiated() const {
55 return was_spdy_negotiated_; 86 return was_spdy_negotiated_;
56 } 87 }
57 88
58 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) { 89 bool SSLClientSocket::set_was_spdy_negotiated(bool negotiated) {
59 return was_spdy_negotiated_ = negotiated; 90 return was_spdy_negotiated_ = negotiated;
60 } 91 }
61 92
62 } // namespace net 93 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket.h ('k') | net/socket/ssl_client_socket_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698