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/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "crypto/ec_private_key.h" | 10 #include "crypto/ec_private_key.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 : signed_cert_timestamps_received_(false), | 25 : signed_cert_timestamps_received_(false), |
26 stapled_ocsp_response_received_(false), | 26 stapled_ocsp_response_received_(false), |
27 negotiation_extension_(kExtensionUnknown) { | 27 negotiation_extension_(kExtensionUnknown) { |
28 } | 28 } |
29 | 29 |
30 // static | 30 // static |
31 NextProto SSLClientSocket::NextProtoFromString( | 31 NextProto SSLClientSocket::NextProtoFromString( |
32 const std::string& proto_string) { | 32 const std::string& proto_string) { |
33 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 33 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
34 return kProtoHTTP11; | 34 return kProtoHTTP11; |
35 } else if (proto_string == "spdy/3") { | |
36 return kProtoSPDY3; | |
37 } else if (proto_string == "spdy/3.1") { | 35 } else if (proto_string == "spdy/3.1") { |
38 return kProtoSPDY31; | 36 return kProtoSPDY31; |
39 } else if (proto_string == "h2") { | 37 } else if (proto_string == "h2") { |
40 return kProtoHTTP2; | 38 return kProtoHTTP2; |
41 } else if (proto_string == "quic/1+spdy/3") { | 39 } else if (proto_string == "quic/1+spdy/3") { |
42 return kProtoQUIC1SPDY3; | 40 return kProtoQUIC1SPDY3; |
43 } else { | 41 } else { |
44 return kProtoUnknown; | 42 return kProtoUnknown; |
45 } | 43 } |
46 } | 44 } |
47 | 45 |
48 // static | 46 // static |
49 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 47 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
50 switch (next_proto) { | 48 switch (next_proto) { |
51 case kProtoHTTP11: | 49 case kProtoHTTP11: |
52 return "http/1.1"; | 50 return "http/1.1"; |
53 case kProtoSPDY3: | |
54 return "spdy/3"; | |
55 case kProtoSPDY31: | 51 case kProtoSPDY31: |
56 return "spdy/3.1"; | 52 return "spdy/3.1"; |
57 case kProtoHTTP2: | 53 case kProtoHTTP2: |
58 return "h2"; | 54 return "h2"; |
59 case kProtoQUIC1SPDY3: | 55 case kProtoQUIC1SPDY3: |
60 return "quic/1+spdy/3"; | 56 return "quic/1+spdy/3"; |
61 case kProtoUnknown: | 57 case kProtoUnknown: |
62 break; | 58 break; |
63 } | 59 } |
64 return "unknown"; | 60 return "unknown"; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 wire_protos.push_back(proto.size()); | 204 wire_protos.push_back(proto.size()); |
209 for (const char ch : proto) { | 205 for (const char ch : proto) { |
210 wire_protos.push_back(static_cast<uint8_t>(ch)); | 206 wire_protos.push_back(static_cast<uint8_t>(ch)); |
211 } | 207 } |
212 } | 208 } |
213 | 209 |
214 return wire_protos; | 210 return wire_protos; |
215 } | 211 } |
216 | 212 |
217 } // namespace net | 213 } // namespace net |
OLD | NEW |