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" |
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 const char kAlternateProtocolHeader[] = "Alternate-Protocol"; | 15 const char kAlternateProtocolHeader[] = "Alternate-Protocol"; |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // The order of these strings much match the order of the enum definition | 19 // The order of these strings much match the order of the enum definition |
20 // for AlternateProtocol. | 20 // for AlternateProtocol. |
21 const char* const kAlternateProtocolStrings[] = { | 21 const char* const kAlternateProtocolStrings[] = { |
22 "npn-spdy/2", | 22 "npn-spdy/2", |
23 "npn-spdy/3", | 23 "npn-spdy/3", |
24 "npn-spdy/3.1", | 24 "npn-spdy/3.1", |
25 "npn-h2-14", // HTTP/2 draft-14. Called SPDY4 internally. | 25 "npn-h2-14", // HTTP/2 draft-14. Called SPDY4 internally. |
26 "npn-h2-15", // HTTP/2 draft-15. Called SPDY4 internally. | 26 "npn-h2-15", // HTTP/2 draft-15. Called SPDY4 internally. |
27 "quic" | 27 "quic" |
28 }; | 28 }; |
29 | 29 |
30 COMPILE_ASSERT( | 30 static_assert(arraysize(kAlternateProtocolStrings) == |
31 arraysize(kAlternateProtocolStrings) == NUM_VALID_ALTERNATE_PROTOCOLS, | 31 NUM_VALID_ALTERNATE_PROTOCOLS, |
32 kAlternateProtocolStringsSize_kNumValidAlternateProtocols_not_equal); | 32 "kAlternateProtocolStrings has incorrect size"); |
33 | 33 |
34 } // namespace | 34 } // namespace |
35 | 35 |
36 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) { | 36 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) { |
37 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, | 37 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, |
38 ALTERNATE_PROTOCOL_USAGE_MAX); | 38 ALTERNATE_PROTOCOL_USAGE_MAX); |
39 } | 39 } |
40 | 40 |
41 void HistogramBrokenAlternateProtocolLocation( | 41 void HistogramBrokenAlternateProtocolLocation( |
42 BrokenAlternateProtocolLocation location){ | 42 BrokenAlternateProtocolLocation location){ |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 is_broken ? " (broken)" : ""); | 108 is_broken ? " (broken)" : ""); |
109 } | 109 } |
110 | 110 |
111 // static | 111 // static |
112 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { | 112 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { |
113 ssl_config->next_protos.clear(); | 113 ssl_config->next_protos.clear(); |
114 ssl_config->next_protos.push_back(kProtoHTTP11); | 114 ssl_config->next_protos.push_back(kProtoHTTP11); |
115 } | 115 } |
116 | 116 |
117 } // namespace net | 117 } // namespace net |
OLD | NEW |