bug 718210 decompress spdy server push headers even when rst r=honzab

This commit is contained in:
Patrick McManus 2012-01-14 22:46:30 -05:00
Родитель 569c6d1acc
Коммит 16ace19a67
1 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -777,7 +777,7 @@ SpdySession::HandleSynStream(SpdySession *self)
NS_ABORT_IF_FALSE(self->mFrameControlType == CONTROL_TYPE_SYN_STREAM,
"wrong control type");
if (self->mFrameDataSize < 12) {
if (self->mFrameDataSize < 18) {
LOG3(("SpdySession::HandleSynStream %p SYN_STREAM too short data=%d",
self, self->mFrameDataSize));
return NS_ERROR_ILLEGAL_VALUE;
@ -785,9 +785,12 @@ SpdySession::HandleSynStream(SpdySession *self)
PRUint32 streamID =
PR_ntohl(reinterpret_cast<PRUint32 *>(self->mFrameBuffer.get())[2]);
PRUint32 associatedID =
PR_ntohl(reinterpret_cast<PRUint32 *>(self->mFrameBuffer.get())[3]);
LOG3(("SpdySession::HandleSynStream %p recv SYN_STREAM (push) for ID 0x%X.",
self, streamID));
LOG3(("SpdySession::HandleSynStream %p recv SYN_STREAM (push) "
"for ID 0x%X associated with 0x%X.",
self, streamID, associatedID));
if (streamID & 0x01) { // test for odd stream ID
LOG3(("SpdySession::HandleSynStream %p recvd SYN_STREAM id must be even.",
@ -802,6 +805,15 @@ SpdySession::HandleSynStream(SpdySession *self)
if (streamID >= kMaxStreamID)
self->mShouldGoAway = true;
// Need to decompress the headers even though we aren't using them yet in
// order to keep the compression context consistent for other syn_reply frames
nsresult rv = self->DownstreamUncompress(self->mFrameBuffer + 18,
self->mFrameDataSize - 10);
if (NS_FAILED(rv)) {
LOG(("SpdySession::HandleSynStream uncompress failed\n"));
return rv;
}
// todo populate cache. For now, just reject server push p3
self->GenerateRstStream(RST_REFUSED_STREAM, streamID);
self->ChangeDownstreamState(BUFFERING_FRAME_HEADER);
@ -872,8 +884,10 @@ SpdySession::HandleSynReply(SpdySession *self)
nsresult rv = self->DownstreamUncompress(self->mFrameBuffer + 14,
self->mFrameDataSize - 6);
if (NS_FAILED(rv))
if (NS_FAILED(rv)) {
LOG(("SpdySession::HandleSynReply uncompress failed\n"));
return rv;
}
Telemetry::Accumulate(Telemetry::SPDY_SYN_REPLY_SIZE,
self->mFrameDataSize - 6);