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/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 19 matching lines...) Expand all Loading... |
30 NextProto SSLClientSocket::NextProtoFromString( | 30 NextProto SSLClientSocket::NextProtoFromString( |
31 const std::string& proto_string) { | 31 const std::string& proto_string) { |
32 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 32 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
33 return kProtoHTTP11; | 33 return kProtoHTTP11; |
34 } else if (proto_string == "spdy/2") { | 34 } else if (proto_string == "spdy/2") { |
35 return kProtoDeprecatedSPDY2; | 35 return kProtoDeprecatedSPDY2; |
36 } else if (proto_string == "spdy/3") { | 36 } else if (proto_string == "spdy/3") { |
37 return kProtoSPDY3; | 37 return kProtoSPDY3; |
38 } else if (proto_string == "spdy/3.1") { | 38 } else if (proto_string == "spdy/3.1") { |
39 return kProtoSPDY31; | 39 return kProtoSPDY31; |
| 40 } else if (proto_string == "h2-14") { |
| 41 // For internal consistency, HTTP/2 is named SPDY4 within Chromium. |
| 42 // This is the HTTP/2 draft-14 identifier. |
| 43 return kProtoSPDY4_14; |
40 } else if (proto_string == "h2-15") { | 44 } else if (proto_string == "h2-15") { |
41 // This is the HTTP/2 draft-15 identifier. For internal | 45 // This is the HTTP/2 draft-15 identifier. |
42 // consistency, HTTP/2 is named SPDY4 within Chromium. | 46 return kProtoSPDY4_15; |
43 return kProtoSPDY4; | |
44 } else if (proto_string == "quic/1+spdy/3") { | 47 } else if (proto_string == "quic/1+spdy/3") { |
45 return kProtoQUIC1SPDY3; | 48 return kProtoQUIC1SPDY3; |
46 } else { | 49 } else { |
47 return kProtoUnknown; | 50 return kProtoUnknown; |
48 } | 51 } |
49 } | 52 } |
50 | 53 |
51 // static | 54 // static |
52 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 55 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
53 switch (next_proto) { | 56 switch (next_proto) { |
54 case kProtoHTTP11: | 57 case kProtoHTTP11: |
55 return "http/1.1"; | 58 return "http/1.1"; |
56 case kProtoDeprecatedSPDY2: | 59 case kProtoDeprecatedSPDY2: |
57 return "spdy/2"; | 60 return "spdy/2"; |
58 case kProtoSPDY3: | 61 case kProtoSPDY3: |
59 return "spdy/3"; | 62 return "spdy/3"; |
60 case kProtoSPDY31: | 63 case kProtoSPDY31: |
61 return "spdy/3.1"; | 64 return "spdy/3.1"; |
62 case kProtoSPDY4: | 65 case kProtoSPDY4_14: |
63 // This is the HTTP/2 draft-15 identifier. For internal | 66 // For internal consistency, HTTP/2 is named SPDY4 within Chromium. |
64 // consistency, HTTP/2 is named SPDY4 within Chromium. | 67 // This is the HTTP/2 draft-14 identifier. |
| 68 return "h2-14"; |
| 69 case kProtoSPDY4_15: |
| 70 // This is the HTTP/2 draft-15 identifier. |
65 return "h2-15"; | 71 return "h2-15"; |
66 case kProtoQUIC1SPDY3: | 72 case kProtoQUIC1SPDY3: |
67 return "quic/1+spdy/3"; | 73 return "quic/1+spdy/3"; |
68 case kProtoUnknown: | 74 case kProtoUnknown: |
69 break; | 75 break; |
70 } | 76 } |
71 return "unknown"; | 77 return "unknown"; |
72 } | 78 } |
73 | 79 |
74 // static | 80 // static |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } else { | 289 } else { |
284 sample += 500; | 290 sample += 500; |
285 } | 291 } |
286 } else { | 292 } else { |
287 DCHECK_EQ(kExtensionALPN, negotiation_extension_); | 293 DCHECK_EQ(kExtensionALPN, negotiation_extension_); |
288 } | 294 } |
289 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); | 295 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); |
290 } | 296 } |
291 | 297 |
292 } // namespace net | 298 } // namespace net |
OLD | NEW |