mirror of
https://github.com/yhirose/cpp-httplib
synced 2026-06-08 18:30:49 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5814e121df | |||
| 7adbccbaf7 | |||
| eb10c22db1 | |||
| 708f860e3a |
@@ -8,7 +8,7 @@
|
||||
#ifndef CPPHTTPLIB_HTTPLIB_H
|
||||
#define CPPHTTPLIB_HTTPLIB_H
|
||||
|
||||
#define CPPHTTPLIB_VERSION "0.18.6"
|
||||
#define CPPHTTPLIB_VERSION "0.18.7"
|
||||
|
||||
/*
|
||||
* Configuration
|
||||
@@ -5381,10 +5381,14 @@ write_multipart_ranges_data(Stream &strm, const Request &req, Response &res,
|
||||
|
||||
inline bool expect_content(const Request &req) {
|
||||
if (req.method == "POST" || req.method == "PUT" || req.method == "PATCH" ||
|
||||
req.method == "PRI" || req.method == "DELETE") {
|
||||
req.method == "DELETE") {
|
||||
return true;
|
||||
}
|
||||
// TODO: check if Content-Length is set
|
||||
if (req.has_header("Content-Length") &&
|
||||
req.get_header_value_u64("Content-Length") > 0) {
|
||||
return true;
|
||||
}
|
||||
if (is_chunked_transfer_encoding(req.headers)) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+13
-1
@@ -2977,6 +2977,11 @@ protected:
|
||||
res.status = 401;
|
||||
res.set_header("WWW-Authenticate", "Basic realm=123456");
|
||||
})
|
||||
.Delete("/issue609",
|
||||
[](const httplib::Request &, httplib::Response &res,
|
||||
const httplib::ContentReader &) {
|
||||
res.set_content("ok", "text/plain");
|
||||
})
|
||||
#if defined(CPPHTTPLIB_ZLIB_SUPPORT) || defined(CPPHTTPLIB_BROTLI_SUPPORT)
|
||||
.Get("/compress",
|
||||
[&](const Request & /*req*/, Response &res) {
|
||||
@@ -4048,6 +4053,13 @@ TEST_F(ServerTest, Issue1772) {
|
||||
EXPECT_EQ(StatusCode::Unauthorized_401, res->status);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, Issue609) {
|
||||
auto res = cli_.Delete("/issue609");
|
||||
ASSERT_TRUE(res);
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
EXPECT_EQ(std::string("ok"), res->body);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, GetStreamedChunked) {
|
||||
auto res = cli_.Get("/streamed-chunked");
|
||||
ASSERT_TRUE(res);
|
||||
@@ -6189,7 +6201,7 @@ TEST(SSLClientTest, WildcardHostNameMatch_Online) {
|
||||
ASSERT_EQ(StatusCode::OK_200, res->status);
|
||||
}
|
||||
|
||||
TEST(SSLClientTest, Issue2004) {
|
||||
TEST(SSLClientTest, Issue2004_Online) {
|
||||
Client client("https://google.com");
|
||||
client.set_follow_location(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user