Fix #2096
This commit is contained in:
parent
5a1ecc3958
commit
48084d55f2
@ -4170,6 +4170,9 @@ inline bool parse_header(const char *beg, const char *end, T fn) {
|
||||
p++;
|
||||
}
|
||||
|
||||
auto name = std::string(beg, p);
|
||||
if (!detail::fields::is_field_name(name)) { return false; }
|
||||
|
||||
if (p == end) { return false; }
|
||||
|
||||
auto key_end = p;
|
||||
|
@ -5156,6 +5156,14 @@ TEST(ServerRequestParsingTest, InvalidFieldValueContains_LF) {
|
||||
EXPECT_EQ("HTTP/1.1 400 Bad Request", out.substr(0, 24));
|
||||
}
|
||||
|
||||
TEST(ServerRequestParsingTest, InvalidFieldNameContains_PreceedingSpaces) {
|
||||
std::string out;
|
||||
std::string request(
|
||||
"GET /header_field_value_check HTTP/1.1\r\n Test: val\r\n\r\n", 55);
|
||||
test_raw_request(request, &out);
|
||||
EXPECT_EQ("HTTP/1.1 400 Bad Request", out.substr(0, 24));
|
||||
}
|
||||
|
||||
TEST(ServerRequestParsingTest, EmptyFieldValue) {
|
||||
std::string out;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user