| 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/http/http_server_properties.h" | 5 #include "net/http/http_server_properties.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "net/socket/ssl_client_socket.h" | 10 #include "net/socket/ssl_client_socket.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 NOTREACHED() << "Invalid NextProto: " << next_proto; | 96 NOTREACHED() << "Invalid NextProto: " << next_proto; |
| 97 return UNINITIALIZED_ALTERNATE_PROTOCOL; | 97 return UNINITIALIZED_ALTERNATE_PROTOCOL; |
| 98 } | 98 } |
| 99 | 99 |
| 100 std::string AlternativeService::ToString() const { | 100 std::string AlternativeService::ToString() const { |
| 101 return base::StringPrintf("%s %s:%d", AlternateProtocolToString(protocol), | 101 return base::StringPrintf("%s %s:%d", AlternateProtocolToString(protocol), |
| 102 host.c_str(), port); | 102 host.c_str(), port); |
| 103 } | 103 } |
| 104 | 104 |
| 105 std::string AlternativeServiceInfo::ToString() const { | 105 std::string AlternativeServiceInfo::ToString() const { |
| 106 return base::StringPrintf("%s, p=%f", alternative_service.ToString().c_str(), | 106 base::Time::Exploded exploded; |
| 107 probability); | 107 expiration.LocalExplode(&exploded); |
| 108 return base::StringPrintf("%s, p=%f, expires %04d-%02d-%02d %02d:%02d:%02d", |
| 109 alternative_service.ToString().c_str(), probability, |
| 110 exploded.year, exploded.month, |
| 111 exploded.day_of_month, exploded.hour, |
| 112 exploded.minute, exploded.second); |
| 108 } | 113 } |
| 109 | 114 |
| 110 // static | 115 // static |
| 111 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { | 116 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { |
| 112 ssl_config->alpn_protos.clear(); | 117 ssl_config->alpn_protos.clear(); |
| 113 ssl_config->alpn_protos.push_back(kProtoHTTP11); | 118 ssl_config->alpn_protos.push_back(kProtoHTTP11); |
| 114 ssl_config->npn_protos.clear(); | 119 ssl_config->npn_protos.clear(); |
| 115 ssl_config->npn_protos.push_back(kProtoHTTP11); | 120 ssl_config->npn_protos.push_back(kProtoHTTP11); |
| 116 } | 121 } |
| 117 | 122 |
| 118 } // namespace net | 123 } // namespace net |
| OLD | NEW |