Chromium Code Reviews

Unified Diff: net/spdy/spdy_protocol.h

Issue 349293010: Deprecate HTTP/2 PAD_HIGH field and enforce max padding size to 256 octets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nullptr => NULL. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_protocol.h
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h
index 1249bbe37b075cb3ffd6e9dde23ae50c08e3fa95..c80c0c06f29f9baac4d3c2a428e6d43e0d7ab397 100644
--- a/net/spdy/spdy_protocol.h
+++ b/net/spdy/spdy_protocol.h
@@ -55,6 +55,9 @@ const int32 kSpdySessionInitialWindowSize = 64 * 1024; // 64 KBytes
// Maximum window size for a Spdy stream or session.
const int32 kSpdyMaximumWindowSize = 0x7FFFFFFF; // Max signed 32bit int
+// Maximum padding size in octets for one DATA or HEADERS or PUSH_PROMISE frame.
+const int32 kPaddingSizePerFrame = 256;
+
// SPDY 2 dictionary.
// This is just a hacked dictionary to use for shrinking HTTP-like headers.
const char kV2Dictionary[] =
@@ -294,8 +297,7 @@ enum SpdyDataFlags {
DATA_FLAG_NONE = 0x00,
DATA_FLAG_FIN = 0x01,
DATA_FLAG_END_SEGMENT = 0x02,
- DATA_FLAG_PAD_LOW = 0x08,
- DATA_FLAG_PAD_HIGH = 0x10,
+ DATA_FLAG_PADDED = 0x08,
DATA_FLAG_COMPRESSED = 0x20,
};
@@ -314,13 +316,13 @@ enum SpdyPingFlags {
enum SpdyHeadersFlags {
HEADERS_FLAG_END_SEGMENT = 0x02,
HEADERS_FLAG_END_HEADERS = 0x04,
- HEADERS_FLAG_PAD_LOW = 0x08,
- HEADERS_FLAG_PAD_HIGH = 0x10,
+ HEADERS_FLAG_PADDED = 0x08,
HEADERS_FLAG_PRIORITY = 0x20,
};
enum SpdyPushPromiseFlags {
PUSH_PROMISE_FLAG_END_PUSH_PROMISE = 0x04,
+ PUSH_PROMISE_FLAG_PADDED = 0x08,
};
// Flags on the SETTINGS control frame.
@@ -621,27 +623,16 @@ class NET_EXPORT_PRIVATE SpdyDataIR
base::StringPiece data() const { return data_; }
- bool pad_low() const { return pad_low_; }
-
- bool pad_high() const { return pad_high_; }
+ bool padded() const { return padded_; }
int padding_payload_len() const { return padding_payload_len_; }
void set_padding_len(int padding_len) {
- // The padding_len should be in (0, 65535 + 2].
- // Note that SpdyFramer::GetDataFrameMaximumPayload() enforces the overall
- // payload size later so we actually can't pad more than 16375 bytes.
DCHECK_GT(padding_len, 0);
- DCHECK_LT(padding_len, 65537);
-
- if (padding_len <= 256) {
- pad_low_ = true;
- --padding_len;
- } else {
- pad_low_ = pad_high_ = true;
- padding_len -= 2;
- }
- padding_payload_len_ = padding_len;
+ DCHECK_LE(padding_len, kPaddingSizePerFrame);
+ padded_ = true;
+ // The pad field takes one octet on the wire.
+ padding_payload_len_ = padding_len - 1;
}
// Deep-copy of data (keep private copy).
@@ -663,8 +654,7 @@ class NET_EXPORT_PRIVATE SpdyDataIR
scoped_ptr<std::string> data_store_;
base::StringPiece data_;
- bool pad_low_;
- bool pad_high_;
+ bool padded_;
// padding_payload_len_ = desired padding length - len(padding length field).
int padding_payload_len_;
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | net/spdy/spdy_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine