Backed out changeset 723587a2ae49 (bug 1531344) for netwerk/test/unit/test_* failures CLOSED TREE

This commit is contained in:
Bogdan Tara 2019-05-08 00:04:32 +03:00
parent a69e6af3a8
commit be70e99ad1
5 changed files with 6 additions and 59 deletions

View File

@ -1880,7 +1880,6 @@ pref("network.http.tcp_keepalive.long_lived_idle_time", 600);
pref("network.http.enforce-framing.http1", false); // should be named "strict"
pref("network.http.enforce-framing.soft", true);
pref("network.http.enforce-framing.strict_chunked_encoding", true);
// Max size, in bytes, for received HTTP response header.
pref("network.http.max_response_header_size", 393216);

View File

@ -34,7 +34,6 @@ class nsHttpChunkedDecoder {
nsHttpHeaderArray* TakeTrailers() { return mTrailers.forget(); }
// How mush data is still missing(needs to arrive) from the current chunk.
uint32_t GetChunkRemaining() { return mChunkRemaining; }
private:

View File

@ -1826,23 +1826,16 @@ void nsHttpHandler::PrefsChanged(const char* pref) {
}
if (PREF_CHANGED(HTTP_PREF("enforce-framing.http1")) ||
PREF_CHANGED(HTTP_PREF("enforce-framing.soft")) ||
PREF_CHANGED(HTTP_PREF("enforce-framing.strict_chunked_encoding"))) {
PREF_CHANGED(HTTP_PREF("enforce-framing.soft"))) {
rv = Preferences::GetBool(HTTP_PREF("enforce-framing.http1"), &cVar);
if (NS_SUCCEEDED(rv) && cVar) {
mEnforceH1Framing = FRAMECHECK_STRICT;
} else {
rv = Preferences::GetBool(
HTTP_PREF("enforce-framing.strict_chunked_encoding"), &cVar);
rv = Preferences::GetBool(HTTP_PREF("enforce-framing.soft"), &cVar);
if (NS_SUCCEEDED(rv) && cVar) {
mEnforceH1Framing = FRAMECHECK_STRICT_CHUNKED;
mEnforceH1Framing = FRAMECHECK_BARELY;
} else {
rv = Preferences::GetBool(HTTP_PREF("enforce-framing.soft"), &cVar);
if (NS_SUCCEEDED(rv) && cVar) {
mEnforceH1Framing = FRAMECHECK_BARELY;
} else {
mEnforceH1Framing = FRAMECHECK_LAX;
}
mEnforceH1Framing = FRAMECHECK_LAX;
}
}
}

View File

@ -47,36 +47,7 @@ class nsHttpConnectionInfo;
class nsHttpTransaction;
class AltSvcMapping;
/*
* FRAMECHECK_LAX - no check
* FRAMECHECK_BARELY - allows:
* 1) that chunk-encoding does not have the last 0-size
* chunk. So, if a chunked-encoded transfer ends on exactly
* a chunk boundary we consider that fine. This will allows
* us to accept buggy servers that do not send the last
* chunk. It will make us not detect a certain amount of
* cut-offs.
* 2) When receiving a gzipped response, we consider a
* gzip stream that doesn't end fine according to the gzip
* decompressing state machine to be a partial transfer.
* If a gzipped transfer ends fine according to the
* decompressor, we do not check for size unalignments.
* This allows to allow HTTP gzipped responses where the
* Content-Length is not the same as the actual contents.
* 3) When receiving HTTP that isn't
* content-encoded/compressed (like in case 2) and not
* chunked (like in case 1), perform the size comparison
* between Content-Length: and the actual size received
* and consider a mismatch to mean a
* NS_ERROR_NET_PARTIAL_TRANSFER error.
* FRAMECHECK_STRICT_CHUNKED - This is the same as FRAMECHECK_BARELY only we
* enforce that the last 0-size chunk is received
* in case 1).
* FRAMECHECK_STRICT - we also do not allow case 2) and 3) from
* FRAMECHECK_BARELY.
*/
enum FrameCheckLevel { FRAMECHECK_LAX, FRAMECHECK_BARELY,
FRAMECHECK_STRICT_CHUNKED, FRAMECHECK_STRICT };
enum FrameCheckLevel { FRAMECHECK_LAX, FRAMECHECK_BARELY, FRAMECHECK_STRICT };
//-----------------------------------------------------------------------------
// nsHttpHandler - protocol handler for HTTP and HTTPS

View File

@ -1129,23 +1129,8 @@ void nsHttpTransaction::Close(nsresult reason) {
if ((mHttpResponseCode / 100 == 2) && (mHttpVersion >= HttpVersion::v1_1)) {
FrameCheckLevel clevel = gHttpHandler->GetEnforceH1Framing();
if (clevel >= FRAMECHECK_BARELY) {
// If clevel == FRAMECHECK_STRICT mark any incomplete response as
// partial.
// if clevel == FRAMECHECK_BARELY: 1) mark a chunked-encoded response
// that do not ends on exactly a chunk boundary as partial; We are not
// strict about the last 0-size chunk and do not mark as parial
// responses that do not have the last 0-size chunk but do end on a
// chunk boundary. (check mChunkedDecoder->GetChunkRemaining() != 0)
// 2) mark a transfer that is partial and it is not chunk-encoded or
// gzip-encoded or other content-encoding as partial. (check
// !mChunkedDecoder && !mContentDecoding && mContentDecodingCheck))
// if clevel == FRAMECHECK_STRICT_CHUNKED mark a chunked-encoded
// response that ends on exactly a chunk boundary also as partial.
// Here a response must have the last 0-size chunk.
if ((clevel == FRAMECHECK_STRICT) ||
(mChunkedDecoder &&
(mChunkedDecoder->GetChunkRemaining() ||
(clevel == FRAMECHECK_STRICT_CHUNKED))) ||
(mChunkedDecoder && mChunkedDecoder->GetChunkRemaining()) ||
(!mChunkedDecoder && !mContentDecoding && mContentDecodingCheck)) {
reason = NS_ERROR_NET_PARTIAL_TRANSFER;
LOG(("Partial transfer, incomplete HTTP response received: %s",