diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-02 00:41:19 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-02 00:41:19 +0000 |
commit | ee77230da9223dc3e5ceeec2812c7cf0365e0e61 (patch) | |
tree | 7967f04c8a4007319f83ddf42436f17c00589432 /net | |
parent | 2a54f965289a9f0a285ef96c00f35a4059c9011d (diff) | |
download | chromium_src-ee77230da9223dc3e5ceeec2812c7cf0365e0e61.zip chromium_src-ee77230da9223dc3e5ceeec2812c7cf0365e0e61.tar.gz chromium_src-ee77230da9223dc3e5ceeec2812c7cf0365e0e61.tar.bz2 |
net: don't DCHECK in SPDY with empty header values.
BUG=172383
Review URL: https://chromiumcodereview.appspot.com/12050008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180217 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/spdy/spdy_framer.cc | 5 | ||||
-rw-r--r-- | net/spdy/spdy_framer_test.cc | 23 |
2 files changed, 27 insertions, 1 deletions
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index 1d1da73..94ab6d1 100644 --- a/net/spdy/spdy_framer.cc +++ b/net/spdy/spdy_framer.cc @@ -705,7 +705,10 @@ static void WriteZ(const base::StringPiece& data, } else { rv = deflate(out, Z_PARTIAL_FLUSH); } - DCHECK_EQ(Z_OK, rv); + if (!data.empty()) { + // If we didn't provide any data then zlib will return Z_BUF_ERROR. + DCHECK_EQ(Z_OK, rv); + } DCHECK_EQ(0u, out->avail_in); DCHECK_LT(0u, out->avail_out); } diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc index c5117c6..98320f6 100644 --- a/net/spdy/spdy_framer_test.cc +++ b/net/spdy/spdy_framer_test.cc @@ -944,6 +944,29 @@ TEST_P(SpdyFramerTest, BasicCompression) { SpdyFrame::kHeaderSize + uncompressed_frame->length())); } +TEST_P(SpdyFramerTest, CompressEmptyHeaders) { + // See crbug.com/172383 + SpdyHeaderBlock headers; + headers["server"] = "SpdyServer 1.0"; + headers["date"] = "Mon 12 Jan 2009 12:12:12 PST"; + headers["status"] = "200"; + headers["version"] = "HTTP/1.1"; + headers["content-type"] = "text/html"; + headers["content-length"] = "12"; + headers["x-empty-header"] = ""; + + SpdyFramer framer(spdy_version_); + framer.set_enable_compression(true); + scoped_ptr<SpdySynStreamControlFrame> frame1( + framer.CreateSynStream(1, // stream id + 0, // associated stream id + 1, // priority + 0, // credential slot + CONTROL_FLAG_NONE, + true, // compress + &headers)); +} + TEST_P(SpdyFramerTest, Basic) { const unsigned char kV2Input[] = { 0x80, spdy_version_, 0x00, 0x01, // SYN Stream #1 |