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/socket/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
6 | 6 |
7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return "h2"; | 50 return "h2"; |
51 case kProtoQUIC1SPDY3: | 51 case kProtoQUIC1SPDY3: |
52 return "quic/1+spdy/3"; | 52 return "quic/1+spdy/3"; |
53 case kProtoUnknown: | 53 case kProtoUnknown: |
54 break; | 54 break; |
55 } | 55 } |
56 return "unknown"; | 56 return "unknown"; |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 const char* SSLClientSocket::NextProtoStatusToString( | |
61 const SSLClientSocket::NextProtoStatus status) { | |
62 switch (status) { | |
63 case kNextProtoUnsupported: | |
64 return "unsupported"; | |
65 case kNextProtoNegotiated: | |
66 return "negotiated"; | |
67 case kNextProtoNoOverlap: | |
68 return "no-overlap"; | |
69 } | |
70 return NULL; | |
71 } | |
72 | |
73 // static | |
74 void SSLClientSocket::SetSSLKeyLogFile( | 60 void SSLClientSocket::SetSSLKeyLogFile( |
75 const base::FilePath& path, | 61 const base::FilePath& path, |
76 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 62 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
77 #if !defined(OS_NACL) | 63 #if !defined(OS_NACL) |
78 SSLClientSocketImpl::SetSSLKeyLogFile(path, task_runner); | 64 SSLClientSocketImpl::SetSSLKeyLogFile(path, task_runner); |
79 #else | 65 #else |
80 NOTIMPLEMENTED(); | 66 NOTIMPLEMENTED(); |
81 #endif | 67 #endif |
82 } | 68 } |
83 | 69 |
(...skipping 13 matching lines...) Expand all Loading... |
97 #endif | 83 #endif |
98 } | 84 } |
99 | 85 |
100 // static | 86 // static |
101 std::vector<uint8_t> SSLClientSocket::SerializeNextProtos( | 87 std::vector<uint8_t> SSLClientSocket::SerializeNextProtos( |
102 const NextProtoVector& next_protos) { | 88 const NextProtoVector& next_protos) { |
103 std::vector<uint8_t> wire_protos; | 89 std::vector<uint8_t> wire_protos; |
104 for (const NextProto next_proto : next_protos) { | 90 for (const NextProto next_proto : next_protos) { |
105 const std::string proto = NextProtoToString(next_proto); | 91 const std::string proto = NextProtoToString(next_proto); |
106 if (proto.size() > 255) { | 92 if (proto.size() > 255) { |
107 LOG(WARNING) << "Ignoring overlong NPN/ALPN protocol: " << proto; | 93 LOG(WARNING) << "Ignoring overlong ALPN protocol: " << proto; |
108 continue; | 94 continue; |
109 } | 95 } |
110 if (proto.size() == 0) { | 96 if (proto.size() == 0) { |
111 LOG(WARNING) << "Ignoring empty NPN/ALPN protocol"; | 97 LOG(WARNING) << "Ignoring empty ALPN protocol"; |
112 continue; | 98 continue; |
113 } | 99 } |
114 wire_protos.push_back(proto.size()); | 100 wire_protos.push_back(proto.size()); |
115 for (const char ch : proto) { | 101 for (const char ch : proto) { |
116 wire_protos.push_back(static_cast<uint8_t>(ch)); | 102 wire_protos.push_back(static_cast<uint8_t>(ch)); |
117 } | 103 } |
118 } | 104 } |
119 | 105 |
120 return wire_protos; | 106 return wire_protos; |
121 } | 107 } |
122 | 108 |
123 } // namespace net | 109 } // namespace net |
OLD | NEW |