| 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/ssl/server_bound_cert_service.h" | 10 #include "net/ssl/server_bound_cert_service.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 NextProto SSLClientSocket::NextProtoFromString( | 25 NextProto SSLClientSocket::NextProtoFromString( |
| 26 const std::string& proto_string) { | 26 const std::string& proto_string) { |
| 27 if (proto_string == "http1.1" || proto_string == "http/1.1") { | 27 if (proto_string == "http1.1" || proto_string == "http/1.1") { |
| 28 return kProtoHTTP11; | 28 return kProtoHTTP11; |
| 29 } else if (proto_string == "spdy/2") { | 29 } else if (proto_string == "spdy/2") { |
| 30 return kProtoDeprecatedSPDY2; | 30 return kProtoDeprecatedSPDY2; |
| 31 } else if (proto_string == "spdy/3") { | 31 } else if (proto_string == "spdy/3") { |
| 32 return kProtoSPDY3; | 32 return kProtoSPDY3; |
| 33 } else if (proto_string == "spdy/3.1") { | 33 } else if (proto_string == "spdy/3.1") { |
| 34 return kProtoSPDY31; | 34 return kProtoSPDY31; |
| 35 } else if (proto_string == "h2-11") { | 35 } else if (proto_string == "h2-12") { |
| 36 // This is the HTTP/2 draft 11 identifier. For internal | 36 // This is the HTTP/2 draft 12 identifier. For internal |
| 37 // consistency, HTTP/2 is named SPDY4 within Chromium. | 37 // consistency, HTTP/2 is named SPDY4 within Chromium. |
| 38 return kProtoSPDY4; | 38 return kProtoSPDY4; |
| 39 } else if (proto_string == "quic/1+spdy/3") { | 39 } else if (proto_string == "quic/1+spdy/3") { |
| 40 return kProtoQUIC1SPDY3; | 40 return kProtoQUIC1SPDY3; |
| 41 } else { | 41 } else { |
| 42 return kProtoUnknown; | 42 return kProtoUnknown; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 // static | 46 // static |
| 47 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { | 47 const char* SSLClientSocket::NextProtoToString(NextProto next_proto) { |
| 48 switch (next_proto) { | 48 switch (next_proto) { |
| 49 case kProtoHTTP11: | 49 case kProtoHTTP11: |
| 50 return "http/1.1"; | 50 return "http/1.1"; |
| 51 case kProtoDeprecatedSPDY2: | 51 case kProtoDeprecatedSPDY2: |
| 52 return "spdy/2"; | 52 return "spdy/2"; |
| 53 case kProtoSPDY3: | 53 case kProtoSPDY3: |
| 54 return "spdy/3"; | 54 return "spdy/3"; |
| 55 case kProtoSPDY31: | 55 case kProtoSPDY31: |
| 56 return "spdy/3.1"; | 56 return "spdy/3.1"; |
| 57 case kProtoSPDY4: | 57 case kProtoSPDY4: |
| 58 // This is the HTTP/2 draft 11 identifier. For internal | 58 // This is the HTTP/2 draft 12 identifier. For internal |
| 59 // consistency, HTTP/2 is named SPDY4 within Chromium. | 59 // consistency, HTTP/2 is named SPDY4 within Chromium. |
| 60 return "h2-11"; | 60 return "h2-12"; |
| 61 case kProtoQUIC1SPDY3: | 61 case kProtoQUIC1SPDY3: |
| 62 return "quic/1+spdy/3"; | 62 return "quic/1+spdy/3"; |
| 63 case kProtoUnknown: | 63 case kProtoUnknown: |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 return "unknown"; | 66 return "unknown"; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // static | 69 // static |
| 70 const char* SSLClientSocket::NextProtoStatusToString( | 70 const char* SSLClientSocket::NextProtoStatusToString( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 if (!server_bound_cert_service->IsSystemTimeValid()) { | 205 if (!server_bound_cert_service->IsSystemTimeValid()) { |
| 206 DVLOG(1) << "System time is not within the supported range for certificate " | 206 DVLOG(1) << "System time is not within the supported range for certificate " |
| 207 "generation, not enabling channel ID."; | 207 "generation, not enabling channel ID."; |
| 208 return false; | 208 return false; |
| 209 } | 209 } |
| 210 return true; | 210 return true; |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace net | 213 } // namespace net |
| OLD | NEW |