| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 std::string AlternativeServiceInfo::ToString() const { | 97 std::string AlternativeServiceInfo::ToString() const { |
| 98 base::Time::Exploded exploded; | 98 base::Time::Exploded exploded; |
| 99 expiration.LocalExplode(&exploded); | 99 expiration.LocalExplode(&exploded); |
| 100 return base::StringPrintf("%s, p=%f, expires %04d-%02d-%02d %02d:%02d:%02d", | 100 return base::StringPrintf("%s, p=%f, expires %04d-%02d-%02d %02d:%02d:%02d", |
| 101 alternative_service.ToString().c_str(), probability, | 101 alternative_service.ToString().c_str(), probability, |
| 102 exploded.year, exploded.month, | 102 exploded.year, exploded.month, |
| 103 exploded.day_of_month, exploded.hour, | 103 exploded.day_of_month, exploded.hour, |
| 104 exploded.minute, exploded.second); | 104 exploded.minute, exploded.second); |
| 105 } | 105 } |
| 106 | 106 |
| 107 SchemeOriginPair::SchemeOriginPair() : host_port_pair_() {} |
| 108 |
| 109 SchemeOriginPair::SchemeOriginPair(const std::string& in_scheme, |
| 110 const HostPortPair& in_host_port) |
| 111 : SchemeOriginPair(in_scheme, in_host_port.host(), in_host_port.port()) {} |
| 112 |
| 113 SchemeOriginPair::SchemeOriginPair(const std::string& in_scheme, |
| 114 const std::string& in_host, |
| 115 uint16_t in_port) |
| 116 : scheme_(in_scheme), host_port_pair_(in_host, in_port) {} |
| 117 |
| 118 // static |
| 119 SchemeOriginPair SchemeOriginPair::FromURL(const GURL& url) { |
| 120 return SchemeOriginPair(url.scheme(), url.HostNoBrackets(), |
| 121 static_cast<uint16_t>(url.EffectiveIntPort())); |
| 122 } |
| 123 |
| 124 bool SchemeOriginPair::Equals(const SchemeOriginPair& other) const { |
| 125 return scheme_ == other.scheme_ && |
| 126 host_port_pair_.Equals(other.host_port_pair()); |
| 127 } |
| 128 |
| 129 bool SchemeOriginPair::IsEmpty() const { |
| 130 return host_port_pair_.host().empty() && host_port_pair_.port() == 0; |
| 131 } |
| 132 |
| 133 bool SchemeOriginPair::operator<(const SchemeOriginPair& other) const { |
| 134 return std::tie(scheme_, host_port_pair_) < |
| 135 std::tie(other.scheme_, other.host_port_pair_); |
| 136 } |
| 137 |
| 107 // static | 138 // static |
| 108 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { | 139 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { |
| 109 ssl_config->alpn_protos.clear(); | 140 ssl_config->alpn_protos.clear(); |
| 110 ssl_config->alpn_protos.push_back(kProtoHTTP11); | 141 ssl_config->alpn_protos.push_back(kProtoHTTP11); |
| 111 ssl_config->npn_protos.clear(); | 142 ssl_config->npn_protos.clear(); |
| 112 ssl_config->npn_protos.push_back(kProtoHTTP11); | 143 ssl_config->npn_protos.push_back(kProtoHTTP11); |
| 113 } | 144 } |
| 114 | 145 |
| 115 } // namespace net | 146 } // namespace net |
| OLD | NEW |