| 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 28 matching lines...) Expand all Loading... |
| 39 return kProtoSPDY3; | 39 return kProtoSPDY3; |
| 40 } else if (proto_string == "spdy/3.1") { | 40 } else if (proto_string == "spdy/3.1") { |
| 41 return kProtoSPDY31; | 41 return kProtoSPDY31; |
| 42 } else if (proto_string == "h2-14") { | 42 } else if (proto_string == "h2-14") { |
| 43 // For internal consistency, HTTP/2 is named SPDY4 within Chromium. | 43 // For internal consistency, HTTP/2 is named SPDY4 within Chromium. |
| 44 // This is the HTTP/2 draft-14 identifier. | 44 // This is the HTTP/2 draft-14 identifier. |
| 45 return kProtoSPDY4_14; | 45 return kProtoSPDY4_14; |
| 46 } else if (proto_string == "h2-15") { | 46 } else if (proto_string == "h2-15") { |
| 47 // This is the HTTP/2 draft-15 identifier. | 47 // This is the HTTP/2 draft-15 identifier. |
| 48 return kProtoSPDY4_15; | 48 return kProtoSPDY4_15; |
| 49 } else if (proto_string == "h2") { |
| 50 return kProtoSPDY4; |
| 49 } else if (proto_string == "quic/1+spdy/3") { | 51 } else if (proto_string == "quic/1+spdy/3") { |
| 50 return kProtoQUIC1SPDY3; | 52 return kProtoQUIC1SPDY3; |
| 51 } else { | 53 } else { |
| 52 return kProtoUnknown; | 54 return kProtoUnknown; |
| 53 } | 55 } |
| 54 } | 56 } |
| 55 | 57 |
| 56 // static | 58 // static |
| 57 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 59 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
| 58 switch (next_proto) { | 60 switch (next_proto) { |
| 59 case kProtoHTTP11: | 61 case kProtoHTTP11: |
| 60 return "http/1.1"; | 62 return "http/1.1"; |
| 61 case kProtoDeprecatedSPDY2: | 63 case kProtoDeprecatedSPDY2: |
| 62 return "spdy/2"; | 64 return "spdy/2"; |
| 63 case kProtoSPDY3: | 65 case kProtoSPDY3: |
| 64 return "spdy/3"; | 66 return "spdy/3"; |
| 65 case kProtoSPDY31: | 67 case kProtoSPDY31: |
| 66 return "spdy/3.1"; | 68 return "spdy/3.1"; |
| 67 case kProtoSPDY4_14: | 69 case kProtoSPDY4_14: |
| 68 // For internal consistency, HTTP/2 is named SPDY4 within Chromium. | 70 // For internal consistency, HTTP/2 is named SPDY4 within Chromium. |
| 69 // This is the HTTP/2 draft-14 identifier. | 71 // This is the HTTP/2 draft-14 identifier. |
| 70 return "h2-14"; | 72 return "h2-14"; |
| 71 case kProtoSPDY4_15: | 73 case kProtoSPDY4_15: |
| 72 // This is the HTTP/2 draft-15 identifier. | 74 // This is the HTTP/2 draft-15 identifier. |
| 73 return "h2-15"; | 75 return "h2-15"; |
| 76 case kProtoSPDY4: |
| 77 return "h2"; |
| 74 case kProtoQUIC1SPDY3: | 78 case kProtoQUIC1SPDY3: |
| 75 return "quic/1+spdy/3"; | 79 return "quic/1+spdy/3"; |
| 76 case kProtoUnknown: | 80 case kProtoUnknown: |
| 77 break; | 81 break; |
| 78 } | 82 } |
| 79 return "unknown"; | 83 return "unknown"; |
| 80 } | 84 } |
| 81 | 85 |
| 82 // static | 86 // static |
| 83 const char* SSLClientSocket::NextProtoStatusToString( | 87 const char* SSLClientSocket::NextProtoStatusToString( |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } else { | 269 } else { |
| 266 sample += 500; | 270 sample += 500; |
| 267 } | 271 } |
| 268 } else { | 272 } else { |
| 269 DCHECK_EQ(kExtensionALPN, negotiation_extension_); | 273 DCHECK_EQ(kExtensionALPN, negotiation_extension_); |
| 270 } | 274 } |
| 271 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); | 275 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SSLProtocolNegotiation", sample); |
| 272 } | 276 } |
| 273 | 277 |
| 274 } // namespace net | 278 } // namespace net |
| OLD | NEW |