| 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" |
| 11 #include "net/ssl/ssl_config.h" | 11 #include "net/ssl/ssl_config.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 namespace { |
| 16 |
| 17 AlternativeProxyUsage ConvertProtocolUsageToProxyUsage( |
| 18 AlternateProtocolUsage usage) { |
| 19 switch (usage) { |
| 20 case ALTERNATE_PROTOCOL_USAGE_NO_RACE: |
| 21 return ALTERNATIVE_PROXY_USAGE_NO_RACE; |
| 22 case ALTERNATE_PROTOCOL_USAGE_WON_RACE: |
| 23 return ALTERNATIVE_PROXY_USAGE_WON_RACE; |
| 24 case ALTERNATE_PROTOCOL_USAGE_LOST_RACE: |
| 25 return ALTERNATIVE_PROXY_USAGE_LOST_RACE; |
| 26 default: |
| 27 NOTREACHED(); |
| 28 return ALTERNATIVE_PROXY_USAGE_MAX; |
| 29 } |
| 30 } |
| 31 |
| 32 } // namespace anonymous |
| 33 |
| 15 const char kAlternativeServiceHeader[] = "Alt-Svc"; | 34 const char kAlternativeServiceHeader[] = "Alt-Svc"; |
| 16 | 35 |
| 17 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) { | 36 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage, |
| 18 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, | 37 bool proxy_server_used) { |
| 19 ALTERNATE_PROTOCOL_USAGE_MAX); | 38 if (proxy_server_used) { |
| 39 DCHECK_LE(usage, ALTERNATE_PROTOCOL_USAGE_LOST_RACE); |
| 40 UMA_HISTOGRAM_ENUMERATION("Net.QuicAlternativeProxy.Usage", |
| 41 ConvertProtocolUsageToProxyUsage(usage), |
| 42 ALTERNATIVE_PROXY_USAGE_MAX); |
| 43 } else { |
| 44 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, |
| 45 ALTERNATE_PROTOCOL_USAGE_MAX); |
| 46 } |
| 20 } | 47 } |
| 21 | 48 |
| 22 void HistogramBrokenAlternateProtocolLocation( | 49 void HistogramBrokenAlternateProtocolLocation( |
| 23 BrokenAlternateProtocolLocation location){ | 50 BrokenAlternateProtocolLocation location){ |
| 24 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, | 51 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, |
| 25 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); | 52 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); |
| 26 } | 53 } |
| 27 | 54 |
| 28 bool IsAlternateProtocolValid(AlternateProtocol protocol) { | 55 bool IsAlternateProtocolValid(AlternateProtocol protocol) { |
| 29 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && | 56 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); | 117 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); |
| 91 } | 118 } |
| 92 | 119 |
| 93 // static | 120 // static |
| 94 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { | 121 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { |
| 95 ssl_config->alpn_protos.clear(); | 122 ssl_config->alpn_protos.clear(); |
| 96 ssl_config->alpn_protos.push_back(kProtoHTTP11); | 123 ssl_config->alpn_protos.push_back(kProtoHTTP11); |
| 97 } | 124 } |
| 98 | 125 |
| 99 } // namespace net | 126 } // namespace net |
| OLD | NEW |