Skip to content

Commit cf475bc

Browse files
committed
Fix #860
1 parent bc80d7c commit cf475bc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

httplib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5257,7 +5257,7 @@ inline bool ClientImpl::read_response_line(Stream &strm, const Request &req,
52575257

52585258
if (!line_reader.getline()) { return false; }
52595259

5260-
const static std::regex re("(HTTP/1\\.[01]) (\\d{3}) (.*?)\r\n");
5260+
const static std::regex re("(HTTP/1\\.[01]) (\\d{3})(?: (.*?))?\r\n");
52615261

52625262
std::cmatch m;
52635263
if (!std::regex_match(line_reader.ptr(), m, re)) {

test/test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,7 @@ TEST_F(ServerTest, GetMethod200) {
16441644
ASSERT_TRUE(res);
16451645
EXPECT_EQ("HTTP/1.1", res->version);
16461646
EXPECT_EQ(200, res->status);
1647+
EXPECT_EQ("OK", res->reason);
16471648
EXPECT_EQ("text/plain", res->get_header_value("Content-Type"));
16481649
EXPECT_EQ(1, res->get_header_value_count("Content-Type"));
16491650
EXPECT_EQ("Hello World!", res->body);

0 commit comments

Comments
 (0)