mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
committed by
Klemens Morgenstern
parent
b4e0f0d560
commit
5866e50438
@ -146,6 +146,9 @@ enum class error
|
||||
/// An obs-fold exceeded an internal limit.
|
||||
bad_obs_fold,
|
||||
|
||||
/// The response contains multiple and conflicting Content-Length.
|
||||
multiple_content_length,
|
||||
|
||||
/** The parser is stale.
|
||||
|
||||
This happens when attempting to re-use a parser that has
|
||||
|
@ -809,6 +809,11 @@ do_field(field f,
|
||||
ec = error::bad_content_length;
|
||||
};
|
||||
|
||||
auto multiple_content_length = [&ec]
|
||||
{
|
||||
ec = error::multiple_content_length;
|
||||
};
|
||||
|
||||
// conflicting field
|
||||
if(f_ & flagChunked)
|
||||
return bad_content_length();
|
||||
@ -831,7 +836,7 @@ do_field(field f,
|
||||
if (existing.has_value())
|
||||
{
|
||||
if (v != *existing)
|
||||
return bad_content_length();
|
||||
return multiple_content_length();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
case error::bad_chunk: return "bad chunk";
|
||||
case error::bad_chunk_extension: return "bad chunk extension";
|
||||
case error::bad_obs_fold: return "bad obs-fold";
|
||||
case error::multiple_content_length: return "multiple Content-Length";
|
||||
case error::stale_parser: return "stale parser";
|
||||
case error::short_read: return "unexpected eof in body";
|
||||
|
||||
|
@ -703,7 +703,7 @@ public:
|
||||
failgrind<P>(c(",\r\n"), error::bad_content_length);
|
||||
failgrind<P>(c("0,\r\n"), error::bad_content_length);
|
||||
failgrind<P>(m("Content-Length: 0\r\n"
|
||||
"Content-Length: 100\r\n"), error::bad_content_length);
|
||||
"Content-Length: 100\r\n"), error::multiple_content_length);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
check("beast.http", error::bad_chunk);
|
||||
check("beast.http", error::bad_chunk_extension);
|
||||
check("beast.http", error::bad_obs_fold);
|
||||
check("beast.http", error::multiple_content_length);
|
||||
|
||||
check("beast.http", error::stale_parser);
|
||||
check("beast.http", error::short_read);
|
||||
|
@ -378,7 +378,7 @@ public:
|
||||
response_parser<string_body> parser;
|
||||
error_code ec;
|
||||
parser.put(net::buffer(message), ec);
|
||||
BEAST_EXPECTS(ec == error::bad_content_length, ec.message());
|
||||
BEAST_EXPECTS(ec == error::multiple_content_length, ec.message());
|
||||
};
|
||||
|
||||
// multiple contents lengths the same
|
||||
|
Reference in New Issue
Block a user