Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: net/http/http_server_properties.cc

Issue 1561203003: Remove SPDY/2 code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: #3. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/socket/next_proto.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 const char kAlternateProtocolHeader[] = "Alternate-Protocol"; 15 const char kAlternateProtocolHeader[] = "Alternate-Protocol";
16 const char kAlternativeServiceHeader[] = "Alt-Svc"; 16 const char kAlternativeServiceHeader[] = "Alt-Svc";
17 17
18 namespace { 18 namespace {
19 19
20 // The order of these strings much match the order of the enum definition 20 // The order of these strings much match the order of the enum definition
21 // for AlternateProtocol. 21 // for AlternateProtocol.
22 const char* const kAlternateProtocolStrings[] = { 22 const char* const kAlternateProtocolStrings[] = {
23 "npn-spdy/2",
24 "npn-spdy/3", 23 "npn-spdy/3",
25 "npn-spdy/3.1", 24 "npn-spdy/3.1",
26 "npn-h2", 25 "npn-h2",
27 "quic"}; 26 "quic"};
28 27
29 static_assert(arraysize(kAlternateProtocolStrings) == 28 static_assert(arraysize(kAlternateProtocolStrings) ==
30 NUM_VALID_ALTERNATE_PROTOCOLS, 29 NUM_VALID_ALTERNATE_PROTOCOLS,
31 "kAlternateProtocolStrings has incorrect size"); 30 "kAlternateProtocolStrings has incorrect size");
32 31
33 } // namespace 32 } // namespace
34 33
35 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) { 34 void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) {
36 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, 35 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage,
37 ALTERNATE_PROTOCOL_USAGE_MAX); 36 ALTERNATE_PROTOCOL_USAGE_MAX);
38 } 37 }
39 38
40 void HistogramBrokenAlternateProtocolLocation( 39 void HistogramBrokenAlternateProtocolLocation(
41 BrokenAlternateProtocolLocation location){ 40 BrokenAlternateProtocolLocation location){
42 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, 41 UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location,
43 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); 42 BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX);
44 } 43 }
45 44
46 bool IsAlternateProtocolValid(AlternateProtocol protocol) { 45 bool IsAlternateProtocolValid(AlternateProtocol protocol) {
47 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && 46 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION &&
48 protocol <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; 47 protocol <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION;
49 } 48 }
50 49
51 const char* AlternateProtocolToString(AlternateProtocol protocol) { 50 const char* AlternateProtocolToString(AlternateProtocol protocol) {
52 switch (protocol) { 51 switch (protocol) {
53 case DEPRECATED_NPN_SPDY_2:
54 case NPN_SPDY_3: 52 case NPN_SPDY_3:
55 case NPN_SPDY_3_1: 53 case NPN_SPDY_3_1:
56 case NPN_HTTP_2: 54 case NPN_HTTP_2:
57 case QUIC: 55 case QUIC:
58 DCHECK(IsAlternateProtocolValid(protocol)); 56 DCHECK(IsAlternateProtocolValid(protocol));
59 return kAlternateProtocolStrings[ 57 return kAlternateProtocolStrings[
60 protocol - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION]; 58 protocol - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION];
61 case UNINITIALIZED_ALTERNATE_PROTOCOL: 59 case UNINITIALIZED_ALTERNATE_PROTOCOL:
62 return "Uninitialized"; 60 return "Uninitialized";
63 } 61 }
64 NOTREACHED(); 62 NOTREACHED();
65 return ""; 63 return "";
66 } 64 }
67 65
68 AlternateProtocol AlternateProtocolFromString(const std::string& str) { 66 AlternateProtocol AlternateProtocolFromString(const std::string& str) {
69 for (int i = ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION; 67 for (int i = ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION;
70 i <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; ++i) { 68 i <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; ++i) {
71 AlternateProtocol protocol = static_cast<AlternateProtocol>(i); 69 AlternateProtocol protocol = static_cast<AlternateProtocol>(i);
72 if (str == AlternateProtocolToString(protocol)) 70 if (str == AlternateProtocolToString(protocol))
73 return protocol; 71 return protocol;
74 } 72 }
75 return UNINITIALIZED_ALTERNATE_PROTOCOL; 73 return UNINITIALIZED_ALTERNATE_PROTOCOL;
76 } 74 }
77 75
78 AlternateProtocol AlternateProtocolFromNextProto(NextProto next_proto) { 76 AlternateProtocol AlternateProtocolFromNextProto(NextProto next_proto) {
79 switch (next_proto) { 77 switch (next_proto) {
80 case kProtoDeprecatedSPDY2:
81 return DEPRECATED_NPN_SPDY_2;
82 case kProtoSPDY3: 78 case kProtoSPDY3:
83 return NPN_SPDY_3; 79 return NPN_SPDY_3;
84 case kProtoSPDY31: 80 case kProtoSPDY31:
85 return NPN_SPDY_3_1; 81 return NPN_SPDY_3_1;
86 case kProtoHTTP2: 82 case kProtoHTTP2:
87 return NPN_HTTP_2; 83 return NPN_HTTP_2;
88 case kProtoQUIC1SPDY3: 84 case kProtoQUIC1SPDY3:
89 return QUIC; 85 return QUIC;
90 86
91 case kProtoUnknown: 87 case kProtoUnknown:
(...skipping 22 matching lines...) Expand all
114 110
115 // static 111 // static
116 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { 112 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) {
117 ssl_config->alpn_protos.clear(); 113 ssl_config->alpn_protos.clear();
118 ssl_config->alpn_protos.push_back(kProtoHTTP11); 114 ssl_config->alpn_protos.push_back(kProtoHTTP11);
119 ssl_config->npn_protos.clear(); 115 ssl_config->npn_protos.clear();
120 ssl_config->npn_protos.push_back(kProtoHTTP11); 116 ssl_config->npn_protos.push_back(kProtoHTTP11);
121 } 117 }
122 118
123 } // namespace net 119 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/socket/next_proto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698