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 18 matching lines...) Expand all Loading... |
29 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && | 29 return protocol >= ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION && |
30 protocol <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; | 30 protocol <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; |
31 } | 31 } |
32 | 32 |
33 const char* AlternateProtocolToString(AlternateProtocol protocol) { | 33 const char* AlternateProtocolToString(AlternateProtocol protocol) { |
34 switch (protocol) { | 34 switch (protocol) { |
35 case QUIC: | 35 case QUIC: |
36 return "quic"; | 36 return "quic"; |
37 case NPN_HTTP_2: | 37 case NPN_HTTP_2: |
38 return "h2"; | 38 return "h2"; |
39 case NPN_SPDY_3_1: | |
40 return "npn-spdy/3.1"; | |
41 case UNINITIALIZED_ALTERNATE_PROTOCOL: | 39 case UNINITIALIZED_ALTERNATE_PROTOCOL: |
42 return "Uninitialized"; | 40 return "Uninitialized"; |
43 } | 41 } |
44 NOTREACHED(); | 42 NOTREACHED(); |
45 return ""; | 43 return ""; |
46 } | 44 } |
47 | 45 |
48 AlternateProtocol AlternateProtocolFromString(const std::string& str) { | 46 AlternateProtocol AlternateProtocolFromString(const std::string& str) { |
49 if (str == "quic") | 47 if (str == "quic") |
50 return QUIC; | 48 return QUIC; |
51 if (str == "h2") | 49 if (str == "h2") |
52 return NPN_HTTP_2; | 50 return NPN_HTTP_2; |
53 // "npn-h2" is accepted here so that persisted settings with the old string | 51 // "npn-h2" and "npn-spdy/3.1" are accepted here so that persisted settings |
54 // can be loaded from disk. TODO(bnc): Remove around 2016 December. | 52 // with the old string can be loaded from disk. TODO(bnc): Remove around |
| 53 // 2016 December. |
55 if (str == "npn-h2") | 54 if (str == "npn-h2") |
56 return NPN_HTTP_2; | 55 return NPN_HTTP_2; |
57 if (str == "npn-spdy/3.1") | 56 if (str == "npn-spdy/3.1") |
58 return NPN_SPDY_3_1; | 57 return NPN_HTTP_2; |
59 | 58 |
60 return UNINITIALIZED_ALTERNATE_PROTOCOL; | 59 return UNINITIALIZED_ALTERNATE_PROTOCOL; |
61 } | 60 } |
62 | 61 |
63 AlternateProtocol AlternateProtocolFromNextProto(NextProto next_proto) { | 62 AlternateProtocol AlternateProtocolFromNextProto(NextProto next_proto) { |
64 switch (next_proto) { | 63 switch (next_proto) { |
65 case kProtoHTTP2: | 64 case kProtoHTTP2: |
66 return NPN_HTTP_2; | 65 return NPN_HTTP_2; |
67 case kProtoQUIC1SPDY3: | 66 case kProtoQUIC1SPDY3: |
68 return QUIC; | 67 return QUIC; |
(...skipping 21 matching lines...) Expand all Loading... |
90 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); | 89 exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); |
91 } | 90 } |
92 | 91 |
93 // static | 92 // static |
94 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { | 93 void HttpServerProperties::ForceHTTP11(SSLConfig* ssl_config) { |
95 ssl_config->alpn_protos.clear(); | 94 ssl_config->alpn_protos.clear(); |
96 ssl_config->alpn_protos.push_back(kProtoHTTP11); | 95 ssl_config->alpn_protos.push_back(kProtoHTTP11); |
97 } | 96 } |
98 | 97 |
99 } // namespace net | 98 } // namespace net |
OLD | NEW |