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

Unified Diff: net/spdy/spdy_alt_svc_wire_format.h

Issue 1130053007: Update HTTP/2 ALTSVC wireformat from draft-04 to draft-06. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hack around win_chromium_compile_dbg_ng linker errors. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/net.gypi ('k') | net/spdy/spdy_alt_svc_wire_format.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_alt_svc_wire_format.h
diff --git a/net/spdy/spdy_alt_svc_wire_format.h b/net/spdy/spdy_alt_svc_wire_format.h
new file mode 100644
index 0000000000000000000000000000000000000000..eb79f8afa60d3829c37a7cf25784d3adb9a0a762
--- /dev/null
+++ b/net/spdy/spdy_alt_svc_wire_format.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains data structures and utility functions used for serializing
+// and parsing alternative service header values, common to HTTP/1.1 header
+// fields and HTTP/2 and QUIC ALTSVC frames. See specification at
+// https://tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html
+
+#ifndef NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
+#define NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
+
+#include "base/basictypes.h"
+#include "base/strings/string_piece.h"
+#include "net/base/net_export.h"
+
+using base::StringPiece;
+
+namespace net {
+
+namespace test {
+class SpdyAltSvcWireFormatPeer;
+} // namespace test
+
+class NET_EXPORT_PRIVATE SpdyAltSvcWireFormat {
+ public:
+ friend class test::SpdyAltSvcWireFormatPeer;
+ static bool ParseHeaderFieldValue(StringPiece value,
+ std::string* protocol_id,
+ std::string* host,
+ uint16* port,
+ uint32* max_age,
+ double* p);
+ static std::string SerializeHeaderFieldValue(const std::string& protocol_id,
+ const std::string& host,
+ uint16 port,
+ uint32 max_age,
+ double p);
+
+ private:
+ static void SkipWhiteSpace(StringPiece::const_iterator* c,
+ StringPiece::const_iterator end);
+ static bool PercentDecode(StringPiece::const_iterator c,
+ StringPiece::const_iterator end,
+ std::string* output);
+ static bool ParseAltAuthority(StringPiece::const_iterator c,
+ StringPiece::const_iterator end,
+ std::string* host,
+ uint16* port);
+ static bool ParsePositiveInteger16(StringPiece::const_iterator c,
+ StringPiece::const_iterator end,
+ uint16* value);
+ static bool ParsePositiveInteger32(StringPiece::const_iterator c,
+ StringPiece::const_iterator end,
+ uint32* value);
+ static bool ParseProbability(StringPiece::const_iterator c,
+ StringPiece::const_iterator end,
+ double* p);
+};
+
+} // namespace net
+
+#endif // NET_SPDY_SPDY_ALT_SVC_WIRE_FORMAT_H_
« no previous file with comments | « net/net.gypi ('k') | net/spdy/spdy_alt_svc_wire_format.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698