keepalive: support multiple post using content provider (#461)

This commit is contained in:
Daniel Ottiger 2020-05-07 14:31:14 +02:00 committed by GitHub
parent 31bb13abd2
commit d043b18097
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -855,6 +855,21 @@ inline void Post(std::vector<Request> &requests, const char *path,
Post(requests, path, Headers(), body, content_type);
}
inline void Post(std::vector<Request> &requests,
const char *path, size_t content_length,
ContentProvider content_provider, const char *content_type) {
Request req;
req.method = "POST";
req.headers = Headers();
req.path = path;
req.content_length = content_length;
req.content_provider = content_provider;
if (content_type) { req.headers.emplace("Content-Type", content_type); }
requests.emplace_back(std::move(req));
}
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
class SSLServer : public Server {
public: