mirror of
https://github.com/boostorg/beast.git
synced 2025-08-03 23:04:35 +02:00
Fix erroneous error when HTTP body_limit is none
fixes #2070 closes #2073
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
Version XXX:
|
Version 301:
|
||||||
|
|
||||||
|
* Fix erroneous error when HTTP `body_limit` is `none`.
|
||||||
* Fix unreachable code warning with MSVC.
|
* Fix unreachable code warning with MSVC.
|
||||||
* Fix logic error in advance_server_flex.
|
* Fix logic error in advance_server_flex.
|
||||||
* Fix file open with append_existing flag on posix.
|
* Fix file open with append_existing flag on posix.
|
||||||
|
@@ -447,7 +447,8 @@ finish_header(error_code& ec, std::true_type)
|
|||||||
}
|
}
|
||||||
else if(f_ & flagContentLength)
|
else if(f_ & flagContentLength)
|
||||||
{
|
{
|
||||||
if(len_ > body_limit_)
|
if(body_limit_.has_value() &&
|
||||||
|
len_ > body_limit_)
|
||||||
{
|
{
|
||||||
ec = error::body_limit;
|
ec = error::body_limit;
|
||||||
return;
|
return;
|
||||||
@@ -511,7 +512,8 @@ finish_header(error_code& ec, std::false_type)
|
|||||||
f_ |= flagHasBody;
|
f_ |= flagHasBody;
|
||||||
state_ = state::body0;
|
state_ = state::body0;
|
||||||
|
|
||||||
if(len_ > body_limit_)
|
if(body_limit_.has_value() &&
|
||||||
|
len_ > body_limit_)
|
||||||
{
|
{
|
||||||
ec = error::body_limit;
|
ec = error::body_limit;
|
||||||
return;
|
return;
|
||||||
|
@@ -1500,6 +1500,23 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testUnlimitedBody()
|
||||||
|
{
|
||||||
|
const char data[] =
|
||||||
|
"POST / HTTP/1.1\r\n"
|
||||||
|
"Content-Length: 5\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"*****";
|
||||||
|
|
||||||
|
test::fail_count fc(1000);
|
||||||
|
test_parser<true> p(fc);
|
||||||
|
p.body_limit(none);
|
||||||
|
error_code ec;
|
||||||
|
p.put(net::buffer(data, strlen(data)), ec);
|
||||||
|
BEAST_EXPECTS(!ec, ec.message());
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1528,6 +1545,7 @@ public:
|
|||||||
testIssue1267();
|
testIssue1267();
|
||||||
testChunkedOverflow();
|
testChunkedOverflow();
|
||||||
testChunkedBodySize();
|
testChunkedBodySize();
|
||||||
|
testUnlimitedBody();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user