From 951e46929e1004df25ec71f24dcc6a0a03c84649 Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 14 Aug 2020 15:01:09 -0400 Subject: [PATCH] Fix #609 --- httplib.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index ffb2783..2df93c7 100644 --- a/httplib.h +++ b/httplib.h @@ -3189,8 +3189,7 @@ get_range_offset_and_length(const Request &req, const 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.has_header("Content-Length"))) { + req.method == "PRI" || req.method == "DELETE") { return true; } // TODO: check if Content-Length is set @@ -4153,6 +4152,10 @@ inline bool Server::read_content_core(Stream &strm, Request &req, Response &res, out = receiver; } + if (req.method == "DELETE" && !req.has_header("Content-Length")) { + return true; + } + if (!detail::read_content(strm, req, payload_max_length_, res.status, nullptr, out, true)) { return false;