| 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.h" | 8 #include "base/metrics/histogram.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 case kProtoHTTP11: | 96 case kProtoHTTP11: |
| 97 break; | 97 break; |
| 98 } | 98 } |
| 99 | 99 |
| 100 NOTREACHED() << "Invalid NextProto: " << next_proto; | 100 NOTREACHED() << "Invalid NextProto: " << next_proto; |
| 101 return UNINITIALIZED_ALTERNATE_PROTOCOL; | 101 return UNINITIALIZED_ALTERNATE_PROTOCOL; |
| 102 } | 102 } |
| 103 | 103 |
| 104 std::string AlternateProtocolInfo::ToString() const { | 104 std::string AlternateProtocolInfo::ToString() const { |
| 105 return base::StringPrintf("%d:%s p=%f%s", port, | 105 return base::StringPrintf("%d:%s p=%f%s", port, |
| 106 AlternateProtocolToString(protocol), | 106 AlternateProtocolToString(protocol), probability, |
| 107 probability, | |
| 108 is_broken ? " (broken)" : ""); | 107 is_broken ? " (broken)" : ""); |
| 109 } | 108 } |
| 110 | 109 |
| 110 std::string AlternateProtocolsToString(const AlternateProtocols& protocols) { |
| 111 std::string output; |
| 112 for (AlternateProtocols::const_iterator it = protocols.begin(); |
| 113 it != protocols.end(); ++it) { |
| 114 if (!output.empty()) |
| 115 output.append("; "); |
| 116 output.append(it->ToString()); |
| 117 } |
| 118 return output; |
| 119 } |
| 120 |
| 111 // static | 121 // static |
| 112 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { | 122 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { |
| 113 ssl_config->next_protos.clear(); | 123 ssl_config->next_protos.clear(); |
| 114 ssl_config->next_protos.push_back(kProtoHTTP11); | 124 ssl_config->next_protos.push_back(kProtoHTTP11); |
| 115 } | 125 } |
| 116 | 126 |
| 117 } // namespace net | 127 } // namespace net |
| OLD | NEW |