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/2") { | |
36 return kProtoDeprecatedSPDY2; | |
37 } else if (proto_string == "spdy/3") { | 35 } else if (proto_string == "spdy/3") { |
38 return kProtoSPDY3; | 36 return kProtoSPDY3; |
39 } else if (proto_string == "spdy/3.1") { | 37 } else if (proto_string == "spdy/3.1") { |
40 return kProtoSPDY31; | 38 return kProtoSPDY31; |
41 } else if (proto_string == "h2") { | 39 } else if (proto_string == "h2") { |
42 return kProtoHTTP2; | 40 return kProtoHTTP2; |
43 } else if (proto_string == "quic/1+spdy/3") { | 41 } else if (proto_string == "quic/1+spdy/3") { |
44 return kProtoQUIC1SPDY3; | 42 return kProtoQUIC1SPDY3; |
45 } else { | 43 } else { |
46 return kProtoUnknown; | 44 return kProtoUnknown; |
47 } | 45 } |
48 } | 46 } |
49 | 47 |
50 // static | 48 // static |
51 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 49 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
52 switch (next_proto) { | 50 switch (next_proto) { |
53 case kProtoHTTP11: | 51 case kProtoHTTP11: |
54 return "http/1.1"; | 52 return "http/1.1"; |
55 case kProtoDeprecatedSPDY2: | |
56 return "spdy/2"; | |
57 case kProtoSPDY3: | 53 case kProtoSPDY3: |
58 return "spdy/3"; | 54 return "spdy/3"; |
59 case kProtoSPDY31: | 55 case kProtoSPDY31: |
60 return "spdy/3.1"; | 56 return "spdy/3.1"; |
61 case kProtoHTTP2: | 57 case kProtoHTTP2: |
62 return "h2"; | 58 return "h2"; |
63 case kProtoQUIC1SPDY3: | 59 case kProtoQUIC1SPDY3: |
64 return "quic/1+spdy/3"; | 60 return "quic/1+spdy/3"; |
65 case kProtoUnknown: | 61 case kProtoUnknown: |
66 break; | 62 break; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 wire_protos.push_back(proto.size()); | 208 wire_protos.push_back(proto.size()); |
213 for (const char ch : proto) { | 209 for (const char ch : proto) { |
214 wire_protos.push_back(static_cast<uint8_t>(ch)); | 210 wire_protos.push_back(static_cast<uint8_t>(ch)); |
215 } | 211 } |
216 } | 212 } |
217 | 213 |
218 return wire_protos; | 214 return wire_protos; |
219 } | 215 } |
220 | 216 |
221 } // namespace net | 217 } // namespace net |
OLD | NEW |