Bug 1236170 - Make Http2Session::UncompressAndDiscard push-aware. r=mcmanus
authorNicholas Hurley <hurley@todesschaf.org>
Mon, 04 Jan 2016 12:17:39 -0800
changeset 278374 ef0cfe8a2f77da20f703a8f514e74846dfddff9d
parent 278373 b7a6c1d777960ae976c19fd9b4612758149b0065
child 278375 cb8a8cfe20da543764a5d8a3d97af098e675c5d3
push id69758
push userhurley@todesschaf.org
push dateMon, 04 Jan 2016 22:41:14 +0000
treeherdermozilla-inbound@ef0cfe8a2f77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1236170
milestone46.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 1236170 - Make Http2Session::UncompressAndDiscard push-aware. r=mcmanus
netwerk/protocol/http/Http2Session.cpp
netwerk/protocol/http/Http2Session.h
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -695,23 +695,23 @@ Http2Session::MaybeDecrementConcurrent(H
   aStream->SetCountAsActive(false);
   --mConcurrent;
   ProcessPending();
 }
 
 // Need to decompress some data in order to keep the compression
 // context correct, but we really don't care what the result is
 nsresult
-Http2Session::UncompressAndDiscard()
+Http2Session::UncompressAndDiscard(bool isPush)
 {
   nsresult rv;
   nsAutoCString trash;
 
   rv = mDecompressor.DecodeHeaderBlock(reinterpret_cast<const uint8_t *>(mDecompressBuffer.BeginReading()),
-                                       mDecompressBuffer.Length(), trash, false);
+                                       mDecompressBuffer.Length(), trash, isPush);
   mDecompressBuffer.Truncate();
   if (NS_FAILED(rv)) {
     LOG3(("Http2Session::UncompressAndDiscard %p Compression Error\n",
           this));
     mGoAwayReason = COMPRESSION_ERROR;
     return rv;
   }
   return NS_OK;
@@ -1234,17 +1234,17 @@ Http2Session::RecvHeaders(Http2Session *
 
     if (self->mInputFrameID >= self->mNextStreamID)
       self->GenerateRstStream(PROTOCOL_ERROR, self->mInputFrameID);
 
     self->mDecompressBuffer.Append(&self->mInputFrameBuffer[kFrameHeaderBytes + paddingControlBytes + priorityLen],
                                    self->mInputFrameDataSize - paddingControlBytes - priorityLen - paddingLength);
 
     if (self->mInputFrameFlags & kFlag_END_HEADERS) {
-      rv = self->UncompressAndDiscard();
+      rv = self->UncompressAndDiscard(false);
       if (NS_FAILED(rv)) {
         LOG3(("Http2Session::RecvHeaders uncompress failed\n"));
         // this is fatal to the session
         self->mGoAwayReason = COMPRESSION_ERROR;
         return rv;
       }
     }
 
@@ -1295,17 +1295,17 @@ Http2Session::ResponseHeadersComplete()
 {
   LOG3(("Http2Session::ResponseHeadersComplete %p for 0x%X fin=%d",
         this, mInputFrameDataStream->StreamID(), mInputFrameFinal));
 
   // only interpret headers once, afterwards ignore as trailers
   if (mInputFrameDataStream->AllHeadersReceived()) {
     LOG3(("Http2Session::ResponseHeadersComplete extra headers"));
     MOZ_ASSERT(mInputFrameFlags & kFlag_END_STREAM);
-    nsresult rv = UncompressAndDiscard();
+    nsresult rv = UncompressAndDiscard(false);
     if (NS_FAILED(rv)) {
       LOG3(("Http2Session::ResponseHeadersComplete extra uncompress failed\n"));
       return rv;
     }
     mFlatHTTPResponseHeadersOut = 0;
     mFlatHTTPResponseHeaders.Truncate();
     if (mInputFrameFinal) {
       // need to process the fin
@@ -1644,17 +1644,17 @@ Http2Session::RecvPushPromise(Http2Sessi
   }
 
   if (resetStream) {
     // Need to decompress the headers even though we aren't using them yet in
     // order to keep the compression context consistent for other frames
     self->mDecompressBuffer.Append(&self->mInputFrameBuffer[kFrameHeaderBytes + paddingControlBytes + promiseLen],
                                    self->mInputFrameDataSize - paddingControlBytes - promiseLen - paddingLength);
     if (self->mInputFrameFlags & kFlag_END_PUSH_PROMISE) {
-      rv = self->UncompressAndDiscard();
+      rv = self->UncompressAndDiscard(true);
       if (NS_FAILED(rv)) {
         LOG3(("Http2Session::RecvPushPromise uncompress failed\n"));
         self->mGoAwayReason = COMPRESSION_ERROR;
         return rv;
       }
     }
     self->ResetDownstreamState();
     return NS_OK;
--- a/netwerk/protocol/http/Http2Session.h
+++ b/netwerk/protocol/http/Http2Session.h
@@ -250,17 +250,17 @@ private:
 
   static const uint8_t kMagicHello[24];
 
   nsresult    ResponseHeadersComplete();
   uint32_t    GetWriteQueueSize();
   void        ChangeDownstreamState(enum internalStateType);
   void        ResetDownstreamState();
   nsresult    ReadyToProcessDataFrame(enum internalStateType);
-  nsresult    UncompressAndDiscard();
+  nsresult    UncompressAndDiscard(bool);
   void        GeneratePing(bool);
   void        GenerateSettingsAck();
   void        GeneratePriority(uint32_t, uint8_t);
   void        GenerateRstStream(uint32_t, uint32_t);
   void        GenerateGoAway(uint32_t);
   void        CleanupStream(Http2Stream *, nsresult, errorType);
   void        CleanupStream(uint32_t, nsresult, errorType);
   void        CloseStream(Http2Stream *, nsresult);