From 09fdf4eacd49606601f539edf3d63f16b9d64415 Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 8 Oct 2020 21:37:42 -0400 Subject: [PATCH] Fix #685 --- httplib.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index 7b29f5f..a881cec 100644 --- a/httplib.h +++ b/httplib.h @@ -4881,7 +4881,10 @@ inline bool ClientImpl::write_request(Stream &strm, const Request &req, auto length = std::to_string(req.content_length); headers.emplace("Content-Length", length); } else { - headers.emplace("Content-Length", "0"); + if (req.method == "POST" || req.method == "PUT" || + req.method == "PATCH") { + headers.emplace("Content-Length", "0"); + } } } else { if (!req.has_header("Content-Type")) { @@ -5844,7 +5847,7 @@ inline void SSLClient::set_ca_cert_path(const char *ca_cert_file_path, inline void SSLClient::set_ca_cert_store(X509_STORE *ca_cert_store) { if (ca_cert_store) { - if(ctx_) { + if (ctx_) { if (SSL_CTX_get_cert_store(ctx_) != ca_cert_store) { // Free memory allocated for old cert and use new store `ca_cert_store` SSL_CTX_set_cert_store(ctx_, ca_cert_store);