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.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "crypto/ec_private_key.h" | 9 #include "crypto/ec_private_key.h" |
10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 NextProto SSLClientSocket::NextProtoFromString( | 26 NextProto SSLClientSocket::NextProtoFromString( |
27 const std::string& proto_string) { | 27 const std::string& proto_string) { |
28 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 28 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
29 return kProtoHTTP11; | 29 return kProtoHTTP11; |
30 } else if (proto_string == "spdy/2") { | 30 } else if (proto_string == "spdy/2") { |
31 return kProtoDeprecatedSPDY2; | 31 return kProtoDeprecatedSPDY2; |
32 } else if (proto_string == "spdy/3") { | 32 } else if (proto_string == "spdy/3") { |
33 return kProtoSPDY3; | 33 return kProtoSPDY3; |
34 } else if (proto_string == "spdy/3.1") { | 34 } else if (proto_string == "spdy/3.1") { |
35 return kProtoSPDY31; | 35 return kProtoSPDY31; |
36 } else if (proto_string == "h2-13") { | 36 } else if (proto_string == "h2-14") { |
37 // This is the HTTP/2 draft 13 identifier. For internal | 37 // This is the HTTP/2 draft 14 identifier. For internal |
38 // consistency, HTTP/2 is named SPDY4 within Chromium. | 38 // consistency, HTTP/2 is named SPDY4 within Chromium. |
39 return kProtoSPDY4; | 39 return kProtoSPDY4; |
40 } else if (proto_string == "quic/1+spdy/3") { | 40 } else if (proto_string == "quic/1+spdy/3") { |
41 return kProtoQUIC1SPDY3; | 41 return kProtoQUIC1SPDY3; |
42 } else { | 42 } else { |
43 return kProtoUnknown; | 43 return kProtoUnknown; |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 // static | 47 // static |
48 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 48 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
49 switch (next_proto) { | 49 switch (next_proto) { |
50 case kProtoHTTP11: | 50 case kProtoHTTP11: |
51 return "http/1.1"; | 51 return "http/1.1"; |
52 case kProtoDeprecatedSPDY2: | 52 case kProtoDeprecatedSPDY2: |
53 return "spdy/2"; | 53 return "spdy/2"; |
54 case kProtoSPDY3: | 54 case kProtoSPDY3: |
55 return "spdy/3"; | 55 return "spdy/3"; |
56 case kProtoSPDY31: | 56 case kProtoSPDY31: |
57 return "spdy/3.1"; | 57 return "spdy/3.1"; |
58 case kProtoSPDY4: | 58 case kProtoSPDY4: |
59 // This is the HTTP/2 draft 13 identifier. For internal | 59 // This is the HTTP/2 draft 14 identifier. For internal |
60 // consistency, HTTP/2 is named SPDY4 within Chromium. | 60 // consistency, HTTP/2 is named SPDY4 within Chromium. |
61 return "h2-13"; | 61 return "h2-14"; |
62 case kProtoQUIC1SPDY3: | 62 case kProtoQUIC1SPDY3: |
63 return "quic/1+spdy/3"; | 63 return "quic/1+spdy/3"; |
64 case kProtoUnknown: | 64 case kProtoUnknown: |
65 break; | 65 break; |
66 } | 66 } |
67 return "unknown"; | 67 return "unknown"; |
68 } | 68 } |
69 | 69 |
70 // static | 70 // static |
71 const char* SSLClientSocket::NextProtoStatusToString( | 71 const char* SSLClientSocket::NextProtoStatusToString( |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 wire_protos.resize(wire_protos.size() + i->size()); | 236 wire_protos.resize(wire_protos.size() + i->size()); |
237 memcpy(&wire_protos[wire_protos.size() - i->size()], | 237 memcpy(&wire_protos[wire_protos.size() - i->size()], |
238 i->data(), i->size()); | 238 i->data(), i->size()); |
239 } | 239 } |
240 DCHECK_EQ(wire_protos.size(), wire_length); | 240 DCHECK_EQ(wire_protos.size(), wire_length); |
241 | 241 |
242 return wire_protos; | 242 return wire_protos; |
243 } | 243 } |
244 | 244 |
245 } // namespace net | 245 } // namespace net |
OLD | NEW |