Ignore Content-Length in some cases:

fix #692

The value of Content-Length is not checked for limits
when the semantics of an HTTP response indicate that
the message has no body. For example, when status is 101.
This commit is contained in:
Vinnie Falco
2017-07-29 12:44:28 -07:00
parent c465ed5a69
commit ea35f6f770
3 changed files with 33 additions and 6 deletions
+19
View File
@@ -1106,6 +1106,24 @@ public:
});
}
// https://github.com/boostorg/beast/issues/692
void
testIssue692()
{
error_code ec;
test_parser<false> p;
p.eager(true);
string_view s =
"HTTP/1.1 101 Switching Protocols\r\n"
"Content-Length: 2147483648\r\n"
"\r\n";
p.put(boost::asio::buffer(
s.data(), s.size()), ec);
if(! BEAST_EXPECTS(! ec, ec.message()))
return;
BEAST_EXPECT(p.is_done());
}
//--------------------------------------------------------------------------
void
@@ -1216,6 +1234,7 @@ public:
testIssue430();
testIssue452();
testIssue496();
testIssue692();
testFuzz();
testRegression1();
}