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 |
32 void SSLClientSocket::SetSSLKeyLogFile( | 60 void SSLClientSocket::SetSSLKeyLogFile( |
33 const base::FilePath& path, | 61 const base::FilePath& path, |
34 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { | 62 const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
35 #if !defined(OS_NACL) | 63 #if !defined(OS_NACL) |
36 SSLClientSocketImpl::SetSSLKeyLogFile(path, task_runner); | 64 SSLClientSocketImpl::SetSSLKeyLogFile(path, task_runner); |
37 #else | 65 #else |
38 NOTIMPLEMENTED(); | 66 NOTIMPLEMENTED(); |
39 #endif | 67 #endif |
40 } | 68 } |
41 | 69 |
(...skipping 30 matching lines...) Expand all Loading... |
72 wire_protos.push_back(proto.size()); | 100 wire_protos.push_back(proto.size()); |
73 for (const char ch : proto) { | 101 for (const char ch : proto) { |
74 wire_protos.push_back(static_cast<uint8_t>(ch)); | 102 wire_protos.push_back(static_cast<uint8_t>(ch)); |
75 } | 103 } |
76 } | 104 } |
77 | 105 |
78 return wire_protos; | 106 return wire_protos; |
79 } | 107 } |
80 | 108 |
81 } // namespace net | 109 } // namespace net |
OLD | NEW |