Bug 1019921 - [http/2] Don't change to discarding padding state when all padding has been processed. r=mcmanus
authorNicholas Hurley <hurley@todesschaf.org>
Tue, 03 Jun 2014 19:41:26 -0700
changeset 205690 4b3198fb55a0fc79d53db08e4b3913e0afad7529
parent 205689 9a5636240f6c9e9cff3b201765f0832ace768db0
child 205691 7b6a7a038a3c314df76ed8036be3df8a38cdbee9
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1019921
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1019921 - [http/2] Don't change to discarding padding state when all padding has been processed. r=mcmanus
netwerk/protocol/http/Http2Session.cpp
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -2733,17 +2733,22 @@ Http2Session::OnWriteSegment(char *buf,
 
     mInputFrameDataRead += *countWritten;
     if (mPaddingLength && (mInputFrameDataSize - mInputFrameDataRead <= mPaddingLength)) {
       // We are crossing from real HTTP data into the realm of padding. If
       // we've actually crossed the line, we need to munge countWritten for the
       // sake of goodness and sanity. No matter what, any future calls to
       // WriteSegments need to just discard data until we reach the end of this
       // frame.
-      ChangeDownstreamState(DISCARDING_DATA_FRAME_PADDING);
+      if (mInputFrameDataSize != mInputFrameDataRead) {
+        // Only change state if we still have padding to read. If we don't do
+        // this, we can end up hanging on frames that combine real data,
+        // padding, and END_STREAM (see bug 1019921)
+        ChangeDownstreamState(DISCARDING_DATA_FRAME_PADDING);
+      }
       uint32_t paddingRead = mPaddingLength - (mInputFrameDataSize - mInputFrameDataRead);
       LOG3(("Http2Session::OnWriteSegment %p stream 0x%X len=%d read=%d "
             "crossed from HTTP data into padding (%d of %d) countWritten=%d",
             this, mInputFrameID, mInputFrameDataSize, mInputFrameDataRead,
             paddingRead, mPaddingLength, *countWritten));
       *countWritten -= paddingRead;
       LOG3(("Http2Session::OnWriteSegment %p stream 0x%X new countWritten=%d",
             this, mInputFrameID, *countWritten));