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

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

Issue 13190010: Switch the QUIC alternate protocol string from "quic/1" to "quic", since QUIC can do its own versio… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/http/http_stream_factory.cc » ('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/stringprintf.h" 8 #include "base/stringprintf.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 const char kAlternateProtocolHeader[] = "Alternate-Protocol"; 12 const char kAlternateProtocolHeader[] = "Alternate-Protocol";
13 // The order of these strings much match the order of the enum definition 13 // The order of these strings much match the order of the enum definition
14 // for AlternateProtocol. 14 // for AlternateProtocol.
15 const char* const kAlternateProtocolStrings[] = { 15 const char* const kAlternateProtocolStrings[] = {
16 "npn-spdy/1", 16 "npn-spdy/1",
17 "npn-spdy/2", 17 "npn-spdy/2",
18 "npn-spdy/3", 18 "npn-spdy/3",
19 "npn-spdy/3.1", 19 "npn-spdy/3.1",
20 "quic/1" 20 "quic"
21 }; 21 };
22 const char kBrokenAlternateProtocol[] = "Broken"; 22 const char kBrokenAlternateProtocol[] = "Broken";
23 23
24 const char* AlternateProtocolToString(AlternateProtocol protocol) { 24 const char* AlternateProtocolToString(AlternateProtocol protocol) {
25 switch (protocol) { 25 switch (protocol) {
26 case NPN_SPDY_1: 26 case NPN_SPDY_1:
27 case NPN_SPDY_2: 27 case NPN_SPDY_2:
28 case NPN_SPDY_3: 28 case NPN_SPDY_3:
29 case QUIC_1: 29 case QUIC:
30 DCHECK_LT(static_cast<size_t>(protocol), 30 DCHECK_LT(static_cast<size_t>(protocol),
31 arraysize(kAlternateProtocolStrings)); 31 arraysize(kAlternateProtocolStrings));
32 return kAlternateProtocolStrings[protocol]; 32 return kAlternateProtocolStrings[protocol];
33 case ALTERNATE_PROTOCOL_BROKEN: 33 case ALTERNATE_PROTOCOL_BROKEN:
34 return kBrokenAlternateProtocol; 34 return kBrokenAlternateProtocol;
35 case UNINITIALIZED_ALTERNATE_PROTOCOL: 35 case UNINITIALIZED_ALTERNATE_PROTOCOL:
36 return "Uninitialized"; 36 return "Uninitialized";
37 default: 37 default:
38 NOTREACHED(); 38 NOTREACHED();
39 return ""; 39 return "";
40 } 40 }
41 } 41 }
42 42
43 AlternateProtocol AlternateProtocolFromString(const std::string& protocol) { 43 AlternateProtocol AlternateProtocolFromString(const std::string& protocol) {
44 for (int i = NPN_SPDY_1; i < NUM_ALTERNATE_PROTOCOLS; ++i) 44 for (int i = NPN_SPDY_1; i < NUM_ALTERNATE_PROTOCOLS; ++i)
45 if (protocol == kAlternateProtocolStrings[i]) 45 if (protocol == kAlternateProtocolStrings[i])
46 return static_cast<AlternateProtocol>(i); 46 return static_cast<AlternateProtocol>(i);
47 if (protocol == kBrokenAlternateProtocol) 47 if (protocol == kBrokenAlternateProtocol)
48 return ALTERNATE_PROTOCOL_BROKEN; 48 return ALTERNATE_PROTOCOL_BROKEN;
49 return UNINITIALIZED_ALTERNATE_PROTOCOL; 49 return UNINITIALIZED_ALTERNATE_PROTOCOL;
50 } 50 }
51 51
52 52
53 std::string PortAlternateProtocolPair::ToString() const { 53 std::string PortAlternateProtocolPair::ToString() const {
54 return base::StringPrintf("%d:%s", port, 54 return base::StringPrintf("%d:%s", port,
55 AlternateProtocolToString(protocol)); 55 AlternateProtocolToString(protocol));
56 } 56 }
57 57
58 } // namespace net 58 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/http/http_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698