mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Fix #2096
This commit is contained in:
parent
5a1ecc3958
commit
48084d55f2
2 changed files with 11 additions and 0 deletions
|
@ -4170,6 +4170,9 @@ inline bool parse_header(const char *beg, const char *end, T fn) {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto name = std::string(beg, p);
|
||||||
|
if (!detail::fields::is_field_name(name)) { return false; }
|
||||||
|
|
||||||
if (p == end) { return false; }
|
if (p == end) { return false; }
|
||||||
|
|
||||||
auto key_end = p;
|
auto key_end = p;
|
||||||
|
|
|
@ -5156,6 +5156,14 @@ TEST(ServerRequestParsingTest, InvalidFieldValueContains_LF) {
|
||||||
EXPECT_EQ("HTTP/1.1 400 Bad Request", out.substr(0, 24));
|
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) {
|
TEST(ServerRequestParsingTest, EmptyFieldValue) {
|
||||||
std::string out;
|
std::string out;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue