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.
|
/// An obs-fold exceeded an internal limit.
|
||||||
bad_obs_fold,
|
bad_obs_fold,
|
||||||
|
|
||||||
|
/// The response contains multiple and conflicting Content-Length.
|
||||||
|
multiple_content_length,
|
||||||
|
|
||||||
/** The parser is stale.
|
/** The parser is stale.
|
||||||
|
|
||||||
This happens when attempting to re-use a parser that has
|
This happens when attempting to re-use a parser that has
|
||||||
|
@ -809,6 +809,11 @@ do_field(field f,
|
|||||||
ec = error::bad_content_length;
|
ec = error::bad_content_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto multiple_content_length = [&ec]
|
||||||
|
{
|
||||||
|
ec = error::multiple_content_length;
|
||||||
|
};
|
||||||
|
|
||||||
// conflicting field
|
// conflicting field
|
||||||
if(f_ & flagChunked)
|
if(f_ & flagChunked)
|
||||||
return bad_content_length();
|
return bad_content_length();
|
||||||
@ -831,7 +836,7 @@ do_field(field f,
|
|||||||
if (existing.has_value())
|
if (existing.has_value())
|
||||||
{
|
{
|
||||||
if (v != *existing)
|
if (v != *existing)
|
||||||
return bad_content_length();
|
return multiple_content_length();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,7 @@ public:
|
|||||||
case error::bad_chunk: return "bad chunk";
|
case error::bad_chunk: return "bad chunk";
|
||||||
case error::bad_chunk_extension: return "bad chunk extension";
|
case error::bad_chunk_extension: return "bad chunk extension";
|
||||||
case error::bad_obs_fold: return "bad obs-fold";
|
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::stale_parser: return "stale parser";
|
||||||
case error::short_read: return "unexpected eof in body";
|
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(",\r\n"), error::bad_content_length);
|
||||||
failgrind<P>(c("0,\r\n"), error::bad_content_length);
|
failgrind<P>(c("0,\r\n"), error::bad_content_length);
|
||||||
failgrind<P>(m("Content-Length: 0\r\n"
|
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
|
void
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
check("beast.http", error::bad_chunk);
|
check("beast.http", error::bad_chunk);
|
||||||
check("beast.http", error::bad_chunk_extension);
|
check("beast.http", error::bad_chunk_extension);
|
||||||
check("beast.http", error::bad_obs_fold);
|
check("beast.http", error::bad_obs_fold);
|
||||||
|
check("beast.http", error::multiple_content_length);
|
||||||
|
|
||||||
check("beast.http", error::stale_parser);
|
check("beast.http", error::stale_parser);
|
||||||
check("beast.http", error::short_read);
|
check("beast.http", error::short_read);
|
||||||
|
@ -378,7 +378,7 @@ public:
|
|||||||
response_parser<string_body> parser;
|
response_parser<string_body> parser;
|
||||||
error_code ec;
|
error_code ec;
|
||||||
parser.put(net::buffer(message), 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
|
// multiple contents lengths the same
|
||||||
|
Reference in New Issue
Block a user