Skip to content

Commit fa90d06

Browse files
committed
Merge branch 'master' of github.com:yhirose/cpp-httplib
2 parents 3701195 + d869054 commit fa90d06

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

httplib.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ struct hash {
396396
}
397397
};
398398

399-
}; // namespace case_ignore
399+
} // namespace case_ignore
400400

401401
// This is based on
402402
// "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4189".
@@ -4114,7 +4114,7 @@ inline bool parse_header(const char *beg, const char *end, T fn) {
41144114
p++;
41154115
}
41164116

4117-
if (p < end) {
4117+
if (p <= end) {
41184118
auto key_len = key_end - beg;
41194119
if (!key_len) { return false; }
41204120

test/test.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4922,6 +4922,15 @@ TEST(ServerRequestParsingTest, InvalidFieldValueContains_CR_LF_NUL) {
49224922
EXPECT_EQ("HTTP/1.1 400 Bad Request", out.substr(0, 24));
49234923
}
49244924

4925+
TEST(ServerRequestParsingTest, EmptyFieldValue) {
4926+
std::string out;
4927+
4928+
test_raw_request("GET /header_field_value_check HTTP/1.1\r\n"
4929+
"Test: \r\n\r\n",
4930+
&out);
4931+
EXPECT_EQ("HTTP/1.1 200 OK", out.substr(0, 15));
4932+
}
4933+
49254934
TEST(ServerStopTest, StopServerWithChunkedTransmission) {
49264935
Server svr;
49274936

0 commit comments

Comments
 (0)