bug 1027364 - multiple http/2 header frames on same stream r=hurley

This commit is contained in:
Patrick McManus 2014-06-19 23:42:29 -04:00
parent d03b8868f9
commit bdd614b6c9
3 changed files with 36 additions and 2 deletions

View File

@ -1159,9 +1159,25 @@ Http2Session::ResponseHeadersComplete()
LOG3(("Http2Session::ResponseHeadersComplete %p for 0x%X fin=%d", LOG3(("Http2Session::ResponseHeadersComplete %p for 0x%X fin=%d",
this, mInputFrameDataStream->StreamID(), mInputFrameFinal)); this, mInputFrameDataStream->StreamID(), mInputFrameFinal));
// only do this once, afterwards ignore trailers // only interpret headers once, afterwards ignore trailers
if (mInputFrameDataStream->AllHeadersReceived()) if (mInputFrameDataStream->AllHeadersReceived()) {
LOG3(("Http2Session::ResponseHeadersComplete extra headers"));
nsresult rv = UncompressAndDiscard();
if (NS_FAILED(rv)) {
LOG3(("Http2Session::ResponseHeadersComplete extra uncompress failed\n"));
return rv;
}
mFlatHTTPResponseHeadersOut = 0;
mFlatHTTPResponseHeaders.Truncate();
if (mInputFrameFinal) {
// need to process the fin
ChangeDownstreamState(PROCESSING_COMPLETE_HEADERS);
} else {
ResetDownstreamState();
}
return NS_OK; return NS_OK;
}
mInputFrameDataStream->SetAllHeadersReceived(); mInputFrameDataStream->SetAllHeadersReceived();
// The stream needs to see flattened http headers // The stream needs to see flattened http headers

View File

@ -292,6 +292,14 @@ function test_http2_push4() {
chan.asyncOpen(listener, chan); chan.asyncOpen(listener, chan);
} }
// this is a basic test where the server sends a simple document with 2 header
// blocks. bug 1027364
function test_http2_doubleheader() {
var chan = makeChan("https://localhost:6944/doubleheader");
var listener = new Http2CheckListener();
chan.asyncOpen(listener, null);
}
// Make sure we handle GETs that cover more than 2 frames properly // Make sure we handle GETs that cover more than 2 frames properly
function test_http2_big() { function test_http2_big() {
var chan = makeChan("https://localhost:6944/big"); var chan = makeChan("https://localhost:6944/big");
@ -338,6 +346,7 @@ var tests = [ test_http2_post_big
, test_http2_push2 , test_http2_push2
, test_http2_push3 , test_http2_push3
, test_http2_push4 , test_http2_push4
, test_http2_doubleheader
, test_http2_xhr , test_http2_xhr
, test_http2_header , test_http2_header
, test_http2_cookie_crumbling , test_http2_cookie_crumbling

View File

@ -114,6 +114,15 @@ function handleRequest(req, res) {
} }
} }
else if (u.pathname === "/doubleheader") {
res.setHeader('Content-Type', 'text/html');
res.writeHead(200);
res.write(content);
res.writeHead(200);
res.end();
return;
}
else if (u.pathname === "/cookie_crumbling") { else if (u.pathname === "/cookie_crumbling") {
res.setHeader("X-Received-Header-Pairs", JSON.stringify(decompressedPairs)); res.setHeader("X-Received-Header-Pairs", JSON.stringify(decompressedPairs));
} }