summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorjgraettinger@chromium.org <jgraettinger@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-07 21:13:56 +0000
committerjgraettinger@chromium.org <jgraettinger@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-07 21:13:56 +0000
commit6be8c074aa951909b265e535d83d8f1b638d9d5b (patch)
treedacac9840c709f81c8bca9905eab8fd8b6d56af6 /net/spdy
parent1483f2c75d659f520440ed92889dca35f2e4e787 (diff)
downloadchromium_src-6be8c074aa951909b265e535d83d8f1b638d9d5b.zip
chromium_src-6be8c074aa951909b265e535d83d8f1b638d9d5b.tar.gz
chromium_src-6be8c074aa951909b265e535d83d8f1b638d9d5b.tar.bz2
Fragment headers payloads at smaller boundaries.
BUG=345769 Review URL: https://codereview.chromium.org/370453004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281586 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_framer.cc8
-rw-r--r--net/spdy/spdy_framer.h6
-rw-r--r--net/spdy/spdy_framer_test.cc4
3 files changed, 12 insertions, 6 deletions
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 5c4648b..e01aca8 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -2586,7 +2586,7 @@ SpdySerializedFrame* SpdyFramer::SerializeHeaders(
headers.name_value_block(), &hpack_encoding);
}
size += hpack_encoding.size();
- if (size > GetControlFrameBufferMaxSize()) {
+ if (size > GetHeaderFragmentMaxSize()) {
size += GetNumberRequiredContinuationFrames(size) *
GetContinuationMinimumSize();
flags &= ~HEADERS_FLAG_END_HEADERS;
@@ -2682,7 +2682,7 @@ SpdyFrame* SpdyFramer::SerializePushPromise(
push_promise.name_value_block(), &hpack_encoding);
}
size += hpack_encoding.size();
- if (size > GetControlFrameBufferMaxSize()) {
+ if (size > GetHeaderFragmentMaxSize()) {
size += GetNumberRequiredContinuationFrames(size) *
GetContinuationMinimumSize();
flags &= ~PUSH_PROMISE_FLAG_END_PUSH_PROMISE;
@@ -2872,7 +2872,7 @@ size_t SpdyFramer::GetSerializedLength(const SpdyHeaderBlock& headers) {
}
size_t SpdyFramer::GetNumberRequiredContinuationFrames(size_t size) {
- const size_t kMaxControlFrameSize = GetControlFrameBufferMaxSize();
+ const size_t kMaxControlFrameSize = GetHeaderFragmentMaxSize();
DCHECK_GT(protocol_version(), SPDY3);
DCHECK_GT(size, kMaxControlFrameSize);
size_t overflow = size - kMaxControlFrameSize;
@@ -2883,7 +2883,7 @@ void SpdyFramer::WritePayloadWithContinuation(SpdyFrameBuilder* builder,
const string& hpack_encoding,
SpdyStreamId stream_id,
SpdyFrameType type) {
- const size_t kMaxControlFrameSize = GetControlFrameBufferMaxSize();
+ const size_t kMaxControlFrameSize = GetHeaderFragmentMaxSize();
// In addition to the prefix, fixed_field_size includes the size of
// any fields that come before the variable-length name/value block.
diff --git a/net/spdy/spdy_framer.h b/net/spdy/spdy_framer.h
index a2ff3ab..85576f5 100644
--- a/net/spdy/spdy_framer.h
+++ b/net/spdy/spdy_framer.h
@@ -718,6 +718,12 @@ class NET_EXPORT_PRIVATE SpdyFramer {
return (1<<14) - 1;
}
+ // TODO(jgraettinger): For h2-13 interop testing coverage,
+ // fragment at smaller payload boundaries.
+ size_t GetHeaderFragmentMaxSize() const {
+ return GetControlFrameBufferMaxSize() >> 4; // 1023 bytes.
+ }
+
// The size of the control frame buffer.
// Since this is only used for control frame headers, the maximum control
// frame header size (SYN_STREAM) is sufficient; all remaining control
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index e896ea3..38ac5c3 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -3197,7 +3197,7 @@ TEST_P(SpdyFramerTest, TooLargeHeadersFrameUsesContinuation) {
EXPECT_TRUE(visitor.header_buffer_valid_);
EXPECT_EQ(0, visitor.error_count_);
EXPECT_EQ(1, visitor.headers_frame_count_);
- EXPECT_EQ(1, visitor.continuation_count_);
+ EXPECT_EQ(16, visitor.continuation_count_);
EXPECT_EQ(1, visitor.zero_length_control_frame_header_data_count_);
}
@@ -3226,7 +3226,7 @@ TEST_P(SpdyFramerTest, TooLargePushPromiseFrameUsesContinuation) {
EXPECT_TRUE(visitor.header_buffer_valid_);
EXPECT_EQ(0, visitor.error_count_);
EXPECT_EQ(1, visitor.push_promise_frame_count_);
- EXPECT_EQ(1, visitor.continuation_count_);
+ EXPECT_EQ(16, visitor.continuation_count_);
EXPECT_EQ(1, visitor.zero_length_control_frame_header_data_count_);
}