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