Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the fix. Btw as explained in #2028 (comment) , we should also add OPTIONS here (or maybe replace HEAD with OPTIONS here, I'm not sure if the browser even use HEAD or not)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. As long as Content-Length is set, things should work. The explicit handling of DELETE is specifically for handlers with content receivers. For OPTIONS requests, we have no such handlers.

I cannot reproduce any issues with OPTIONS. If that still fails, let me know what you're doing and I'll check on my end.

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;
}

Expand Down