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

Side by Side Diff: net/spdy/spdy_alt_svc_wire_format.h

Issue 1410343005: Update version parameter format in SpdyAltSvcWireFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | net/spdy/spdy_alt_svc_wire_format.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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 // This file contains data structures and utility functions used for serializing 5 // This file contains data structures and utility functions used for serializing
6 // and parsing alternative service header values, common to HTTP/1.1 header 6 // and parsing alternative service header values, common to HTTP/1.1 header
7 // fields and HTTP/2 and QUIC ALTSVC frames. See specification at 7 // fields and HTTP/2 and QUIC ALTSVC frames. See specification at
8 // https://httpwg.github.io/http-extensions/alt-svc.html. 8 // https://httpwg.github.io/http-extensions/alt-svc.html.
9 9
10 #ifndef NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_ 10 #ifndef NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
11 #define NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_ 11 #define NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "net/base/net_export.h" 17 #include "net/base/net_export.h"
18 18
19 using base::StringPiece; 19 using base::StringPiece;
20 20
21 namespace net { 21 namespace net {
22 22
23 namespace test { 23 namespace test {
24 class SpdyAltSvcWireFormatPeer; 24 class SpdyAltSvcWireFormatPeer;
25 } // namespace test 25 } // namespace test
26 26
27 class NET_EXPORT_PRIVATE SpdyAltSvcWireFormat { 27 class NET_EXPORT_PRIVATE SpdyAltSvcWireFormat {
28 public: 28 public:
29 using VersionVector = std::vector<uint16>;
30
29 struct NET_EXPORT_PRIVATE AlternativeService { 31 struct NET_EXPORT_PRIVATE AlternativeService {
30 std::string protocol_id; 32 std::string protocol_id;
31 std::string host; 33 std::string host;
34
32 // Default is 0: invalid port. 35 // Default is 0: invalid port.
33 uint16 port = 0; 36 uint16 port = 0;
34 // Default is 0: unspecified version.
35 uint16 version = 0;
36 // Default is one day. 37 // Default is one day.
37 uint32 max_age = 86400; 38 uint32 max_age = 86400;
38 // Default is always use. 39 // Default is always use.
39 double probability = 1.0; 40 double probability = 1.0;
41 // Default is empty: unspecified version.
42 VersionVector version;
40 43
41 AlternativeService(); 44 AlternativeService();
42 AlternativeService(const std::string& protocol_id, 45 AlternativeService(const std::string& protocol_id,
43 const std::string& host, 46 const std::string& host,
44 uint16 port, 47 uint16 port,
45 uint16 version,
46 uint32 max_age, 48 uint32 max_age,
47 double probability); 49 double probability,
50 VersionVector version);
51 ~AlternativeService();
48 52
49 bool operator==(const AlternativeService& other) const { 53 bool operator==(const AlternativeService& other) const {
50 return protocol_id == other.protocol_id && host == other.host && 54 return protocol_id == other.protocol_id && host == other.host &&
51 port == other.port && version == other.version && 55 port == other.port && version == other.version &&
52 max_age == other.max_age && probability == other.probability; 56 max_age == other.max_age && probability == other.probability;
53 } 57 }
54 }; 58 };
55 // An empty vector means alternative services should be cleared for given 59 // An empty vector means alternative services should be cleared for given
56 // origin. Note that the wire format for this is the string "clear", not an 60 // origin. Note that the wire format for this is the string "clear", not an
57 // empty value (which is invalid). 61 // empty value (which is invalid).
(...skipping 22 matching lines...) Expand all
80 StringPiece::const_iterator end, 84 StringPiece::const_iterator end,
81 uint32* value); 85 uint32* value);
82 static bool ParseProbability(StringPiece::const_iterator c, 86 static bool ParseProbability(StringPiece::const_iterator c,
83 StringPiece::const_iterator end, 87 StringPiece::const_iterator end,
84 double* probability); 88 double* probability);
85 }; 89 };
86 90
87 } // namespace net 91 } // namespace net
88 92
89 #endif // NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_ 93 #endif // NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_alt_svc_wire_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698