diff --git a/httplib.h b/httplib.h index e15ba44f22..d1f332e7e3 100644 --- a/httplib.h +++ b/httplib.h @@ -258,7 +258,6 @@ using socklen_t = int; #ifdef __linux__ #include #endif -#include #include #include #include @@ -267,6 +266,8 @@ using socklen_t = int; #include #include +#include + using socket_t = int; #ifndef INVALID_SOCKET #define INVALID_SOCKET (-1) @@ -277,6 +278,10 @@ using socket_t = int; #include #endif +#include +#include +#include + #include #include #include @@ -285,9 +290,7 @@ using socket_t = int; #include #include #include -#include #include -#include #include #include #include @@ -300,7 +303,6 @@ using socket_t = int; #include #include #include -#include #include #include #include @@ -5549,7 +5551,6 @@ class FormDataParser { bool parse(const char *buf, size_t n, const FormDataHeader &header_callback, const ContentReceiver &content_callback) { - buf_append(buf, n); while (buf_size() > 0) { @@ -7819,8 +7820,11 @@ inline bool Server::read_content_core( multipart_receiver); }; } else { - out = [receiver](const char *buf, size_t n, size_t /*off*/, - size_t /*len*/) { return receiver(buf, n); }; + out = [receiver, &req](const char *buf, size_t n, size_t /*off*/, + size_t len) { + if (len > 0) { req.body.reserve(len); } + return receiver(buf, n); + }; } if (req.method == "DELETE" && !req.has_header("Content-Length")) { @@ -10745,7 +10749,6 @@ inline SSL_CTX *SSLServer::ssl_context() const { return ctx_; } inline void SSLServer::update_certs(X509 *cert, EVP_PKEY *private_key, X509_STORE *client_ca_cert_store) { - std::lock_guard guard(ctx_mutex_); SSL_CTX_use_certificate(ctx_, cert); @@ -11809,8 +11812,8 @@ inline void Client::set_follow_location(bool on) { inline void Client::set_path_encode(bool on) { cli_->set_path_encode(on); } -[[deprecated("Use set_path_encode instead")]] -inline void Client::set_url_encode(bool on) { +[[deprecated("Use set_path_encode instead")]] inline void +Client::set_url_encode(bool on) { cli_->set_path_encode(on); }