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 11 matching lines...) Expand all Loading... |
22 const base::Feature kPostQuantumExperiment{"SSLPostQuantumExperiment", | 22 const base::Feature kPostQuantumExperiment{"SSLPostQuantumExperiment", |
23 base::FEATURE_DISABLED_BY_DEFAULT}; | 23 base::FEATURE_DISABLED_BY_DEFAULT}; |
24 #endif | 24 #endif |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 SSLClientSocket::SSLClientSocket() | 27 SSLClientSocket::SSLClientSocket() |
28 : signed_cert_timestamps_received_(false), | 28 : signed_cert_timestamps_received_(false), |
29 stapled_ocsp_response_received_(false) {} | 29 stapled_ocsp_response_received_(false) {} |
30 | 30 |
31 // static | 31 // static |
32 NextProto SSLClientSocket::NextProtoFromString(base::StringPiece proto_string) { | |
33 if (proto_string == "http1.1" || proto_string == "http/1.1") { | |
34 return kProtoHTTP11; | |
35 } else if (proto_string == "h2") { | |
36 return kProtoHTTP2; | |
37 } else if (proto_string == "quic/1+spdy/3") { | |
38 return kProtoQUIC; | |
39 } else { | |
40 return kProtoUnknown; | |
41 } | |
42 } | |
43 | |
44 // static | |
45 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | |
46 switch (next_proto) { | |
47 case kProtoHTTP11: | |
48 return "http/1.1"; | |
49 case kProtoHTTP2: | |
50 return "h2"; | |
51 case kProtoQUIC: | |
52 return "quic/1+spdy/3"; | |
53 case kProtoUnknown: | |
54 break; | |
55 } | |
56 return "unknown"; | |
57 } | |
58 | |
59 // static | |
60 void SSLClientSocket::SetSSLKeyLogFile( | 32 void SSLClientSocket::SetSSLKeyLogFile( |
61 const base::FilePath& path, | 33 const base::FilePath& path, |
62 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 34 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
63 #if !defined(OS_NACL) | 35 #if !defined(OS_NACL) |
64 SSLClientSocketImpl::SetSSLKeyLogFile(path, task_runner); | 36 SSLClientSocketImpl::SetSSLKeyLogFile(path, task_runner); |
65 #else | 37 #else |
66 NOTIMPLEMENTED(); | 38 NOTIMPLEMENTED(); |
67 #endif | 39 #endif |
68 } | 40 } |
69 | 41 |
(...skipping 30 matching lines...) Expand all Loading... |
100 wire_protos.push_back(proto.size()); | 72 wire_protos.push_back(proto.size()); |
101 for (const char ch : proto) { | 73 for (const char ch : proto) { |
102 wire_protos.push_back(static_cast<uint8_t>(ch)); | 74 wire_protos.push_back(static_cast<uint8_t>(ch)); |
103 } | 75 } |
104 } | 76 } |
105 | 77 |
106 return wire_protos; | 78 return wire_protos; |
107 } | 79 } |
108 | 80 |
109 } // namespace net | 81 } // namespace net |
OLD | NEW |