Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d869054

Browse files
Allow empty header values (yhirose#1965)
1 parent 0cc1ca9 commit d869054

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎httplib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4115,7 +4115,7 @@ inline bool parse_header(const char *beg, const char *end, T fn) {
41154115
p++;
41164116
}
41174117

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

‎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)

AltStyle によって変換されたページ (->オリジナル) /