|
|
|
@@ -8,8 +8,8 @@
|
|
|
|
|
#ifndef CPPHTTPLIB_HTTPLIB_H
|
|
|
|
|
#define CPPHTTPLIB_HTTPLIB_H
|
|
|
|
|
|
|
|
|
|
#define CPPHTTPLIB_VERSION "0.27.0"
|
|
|
|
|
#define CPPHTTPLIB_VERSION_NUM "0x001B00"
|
|
|
|
|
#define CPPHTTPLIB_VERSION "0.28.0"
|
|
|
|
|
#define CPPHTTPLIB_VERSION_NUM "0x001C00"
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Platform compatibility check
|
|
|
|
@@ -257,6 +257,7 @@ using socklen_t = int;
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#ifdef __linux__
|
|
|
|
|
#include <resolv.h>
|
|
|
|
|
#undef _res // Undefine _res macro to avoid conflicts with user code (#2278)
|
|
|
|
|
#endif
|
|
|
|
|
#include <csignal>
|
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
@@ -1421,14 +1422,18 @@ public:
|
|
|
|
|
Result Post(const std::string &path, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Params ¶ms);
|
|
|
|
|
Result Post(const std::string &path, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, DownloadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, DownloadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const Params ¶ms);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const UploadFormDataItems &items, const std::string &boundary, UploadProgress progress = nullptr);
|
|
|
|
@@ -1439,14 +1444,18 @@ public:
|
|
|
|
|
Result Put(const std::string &path, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Params ¶ms);
|
|
|
|
|
Result Put(const std::string &path, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const Params ¶ms);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const UploadFormDataItems &items, const std::string &boundary, UploadProgress progress = nullptr);
|
|
|
|
@@ -1457,14 +1466,18 @@ public:
|
|
|
|
|
Result Patch(const std::string &path, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Params ¶ms);
|
|
|
|
|
Result Patch(const std::string &path, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const Params ¶ms);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const UploadFormDataItems &items, const std::string &boundary, UploadProgress progress = nullptr);
|
|
|
|
@@ -1712,17 +1725,19 @@ private:
|
|
|
|
|
template <typename ClientType> void setup_redirect_client(ClientType &client);
|
|
|
|
|
bool handle_request(Stream &strm, Request &req, Response &res,
|
|
|
|
|
bool close_connection, Error &error);
|
|
|
|
|
std::unique_ptr<Response> send_with_content_provider(
|
|
|
|
|
std::unique_ptr<Response> send_with_content_provider_and_receiver(
|
|
|
|
|
Request &req, const char *body, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
ContentProviderWithoutLength content_provider_without_length,
|
|
|
|
|
const std::string &content_type, Error &error);
|
|
|
|
|
Result send_with_content_provider(
|
|
|
|
|
const std::string &content_type, ContentReceiver content_receiver,
|
|
|
|
|
Error &error);
|
|
|
|
|
Result send_with_content_provider_and_receiver(
|
|
|
|
|
const std::string &method, const std::string &path,
|
|
|
|
|
const Headers &headers, const char *body, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
ContentProviderWithoutLength content_provider_without_length,
|
|
|
|
|
const std::string &content_type, UploadProgress progress);
|
|
|
|
|
const std::string &content_type, ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress);
|
|
|
|
|
ContentProviderWithoutLength get_multipart_content_provider(
|
|
|
|
|
const std::string &boundary, const UploadFormDataItems &items,
|
|
|
|
|
const FormDataProviderItems &provider_items) const;
|
|
|
|
@@ -1775,14 +1790,18 @@ public:
|
|
|
|
|
Result Post(const std::string &path, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Params ¶ms);
|
|
|
|
|
Result Post(const std::string &path, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, DownloadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, DownloadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const Params ¶ms);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Post(const std::string &path, const Headers &headers, const UploadFormDataItems &items, const std::string &boundary, UploadProgress progress = nullptr);
|
|
|
|
@@ -1793,14 +1812,18 @@ public:
|
|
|
|
|
Result Put(const std::string &path, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Params ¶ms);
|
|
|
|
|
Result Put(const std::string &path, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const Params ¶ms);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Put(const std::string &path, const Headers &headers, const UploadFormDataItems &items, const std::string &boundary, UploadProgress progress = nullptr);
|
|
|
|
@@ -1811,14 +1834,18 @@ public:
|
|
|
|
|
Result Patch(const std::string &path, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Params ¶ms);
|
|
|
|
|
Result Patch(const std::string &path, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const char *body, size_t content_length, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const std::string &body, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, size_t content_length, ContentProvider content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, ContentProviderWithoutLength content_provider, const std::string &content_type, ContentReceiver content_receiver, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const Params ¶ms);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const UploadFormDataItems &items, UploadProgress progress = nullptr);
|
|
|
|
|
Result Patch(const std::string &path, const Headers &headers, const UploadFormDataItems &items, const std::string &boundary, UploadProgress progress = nullptr);
|
|
|
|
@@ -3809,22 +3836,30 @@ inline int getaddrinfo_with_timeout(const char *node, const char *service,
|
|
|
|
|
// Fallback implementation using thread-based timeout for other Unix systems
|
|
|
|
|
|
|
|
|
|
struct GetAddrInfoState {
|
|
|
|
|
~GetAddrInfoState() {
|
|
|
|
|
if (info) { freeaddrinfo(info); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::mutex mutex;
|
|
|
|
|
std::condition_variable result_cv;
|
|
|
|
|
bool completed = false;
|
|
|
|
|
int result = EAI_SYSTEM;
|
|
|
|
|
std::string node = node;
|
|
|
|
|
std::string service = service;
|
|
|
|
|
struct addrinfo hints = hints;
|
|
|
|
|
std::string node;
|
|
|
|
|
std::string service;
|
|
|
|
|
struct addrinfo hints;
|
|
|
|
|
struct addrinfo *info = nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Allocate on the heap, so the resolver thread can keep using the data.
|
|
|
|
|
auto state = std::make_shared<GetAddrInfoState>();
|
|
|
|
|
state->node = node;
|
|
|
|
|
state->service = service;
|
|
|
|
|
state->hints = *hints;
|
|
|
|
|
|
|
|
|
|
std::thread resolve_thread([=]() {
|
|
|
|
|
auto thread_result = getaddrinfo(
|
|
|
|
|
state->node.c_str(), state->service.c_str(), hints, &state->info);
|
|
|
|
|
std::thread resolve_thread([state]() {
|
|
|
|
|
auto thread_result =
|
|
|
|
|
getaddrinfo(state->node.c_str(), state->service.c_str(), &state->hints,
|
|
|
|
|
&state->info);
|
|
|
|
|
|
|
|
|
|
std::lock_guard<std::mutex> lock(state->mutex);
|
|
|
|
|
state->result = thread_result;
|
|
|
|
@@ -3842,6 +3877,7 @@ inline int getaddrinfo_with_timeout(const char *node, const char *service,
|
|
|
|
|
// Operation completed within timeout
|
|
|
|
|
resolve_thread.join();
|
|
|
|
|
*res = state->info;
|
|
|
|
|
state->info = nullptr; // Pass ownership to caller
|
|
|
|
|
return state->result;
|
|
|
|
|
} else {
|
|
|
|
|
// Timeout occurred
|
|
|
|
@@ -7692,7 +7728,8 @@ inline bool Server::write_response_core(Stream &strm, bool close_connection,
|
|
|
|
|
if (need_apply_ranges) { apply_ranges(req, res, content_type, boundary); }
|
|
|
|
|
|
|
|
|
|
// Prepare additional headers
|
|
|
|
|
if (close_connection || req.get_header_value("Connection") == "close") {
|
|
|
|
|
if (close_connection || req.get_header_value("Connection") == "close" ||
|
|
|
|
|
400 <= res.status) { // Don't leave connections open after errors
|
|
|
|
|
res.set_header("Connection", "close");
|
|
|
|
|
} else {
|
|
|
|
|
std::string s = "timeout=";
|
|
|
|
@@ -7895,7 +7932,11 @@ inline bool Server::read_content_core(
|
|
|
|
|
size_t /*len*/) { return receiver(buf, n); };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (req.method == "DELETE" && !req.has_header("Content-Length")) {
|
|
|
|
|
// RFC 7230 Section 3.3.3: If this is a request message and none of the above
|
|
|
|
|
// are true (no Transfer-Encoding and no Content-Length), then the message
|
|
|
|
|
// body length is zero (no message body is present).
|
|
|
|
|
if (!req.has_header("Content-Length") &&
|
|
|
|
|
!detail::is_chunked_transfer_encoding(req.headers)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -8403,8 +8444,6 @@ Server::process_request(Stream &strm, const std::string &remote_addr,
|
|
|
|
|
|
|
|
|
|
// Check if the request URI doesn't exceed the limit
|
|
|
|
|
if (req.target.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) {
|
|
|
|
|
Headers dummy;
|
|
|
|
|
detail::read_headers(strm, dummy);
|
|
|
|
|
res.status = StatusCode::UriTooLong_414;
|
|
|
|
|
output_error_log(Error::ExceedUriMaxLength, &req);
|
|
|
|
|
return write_response(strm, close_connection, req, res);
|
|
|
|
@@ -9388,11 +9427,13 @@ inline bool ClientImpl::write_request(Stream &strm, Request &req,
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline std::unique_ptr<Response> ClientImpl::send_with_content_provider(
|
|
|
|
|
inline std::unique_ptr<Response>
|
|
|
|
|
ClientImpl::send_with_content_provider_and_receiver(
|
|
|
|
|
Request &req, const char *body, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
ContentProviderWithoutLength content_provider_without_length,
|
|
|
|
|
const std::string &content_type, Error &error) {
|
|
|
|
|
const std::string &content_type, ContentReceiver content_receiver,
|
|
|
|
|
Error &error) {
|
|
|
|
|
if (!content_type.empty()) { req.set_header("Content-Type", content_type); }
|
|
|
|
|
|
|
|
|
|
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
|
|
|
@@ -9465,15 +9506,24 @@ inline std::unique_ptr<Response> ClientImpl::send_with_content_provider(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (content_receiver) {
|
|
|
|
|
req.content_receiver =
|
|
|
|
|
[content_receiver](const char *data, size_t data_length,
|
|
|
|
|
size_t /*offset*/, size_t /*total_length*/) {
|
|
|
|
|
return content_receiver(data, data_length);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto res = detail::make_unique<Response>();
|
|
|
|
|
return send(req, *res, error) ? std::move(res) : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::send_with_content_provider(
|
|
|
|
|
inline Result ClientImpl::send_with_content_provider_and_receiver(
|
|
|
|
|
const std::string &method, const std::string &path, const Headers &headers,
|
|
|
|
|
const char *body, size_t content_length, ContentProvider content_provider,
|
|
|
|
|
ContentProviderWithoutLength content_provider_without_length,
|
|
|
|
|
const std::string &content_type, UploadProgress progress) {
|
|
|
|
|
const std::string &content_type, ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
Request req;
|
|
|
|
|
req.method = method;
|
|
|
|
|
req.headers = headers;
|
|
|
|
@@ -9485,9 +9535,10 @@ inline Result ClientImpl::send_with_content_provider(
|
|
|
|
|
|
|
|
|
|
auto error = Error::Success;
|
|
|
|
|
|
|
|
|
|
auto res = send_with_content_provider(
|
|
|
|
|
auto res = send_with_content_provider_and_receiver(
|
|
|
|
|
req, body, content_length, std::move(content_provider),
|
|
|
|
|
std::move(content_provider_without_length), content_type, error);
|
|
|
|
|
std::move(content_provider_without_length), content_type,
|
|
|
|
|
std::move(content_receiver), error);
|
|
|
|
|
|
|
|
|
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
|
|
|
|
return Result{std::move(res), error, std::move(req.headers), last_ssl_error_,
|
|
|
|
@@ -9816,6 +9867,15 @@ inline Result ClientImpl::Post(const std::string &path, size_t content_length,
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return Post(path, Headers(), content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
@@ -9824,6 +9884,15 @@ inline Result ClientImpl::Post(const std::string &path,
|
|
|
|
|
progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return Post(path, Headers(), std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
const Params ¶ms) {
|
|
|
|
|
auto query = detail::params_to_query_str(params);
|
|
|
|
@@ -9864,17 +9933,18 @@ inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
const char *body, size_t content_length,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("POST", path, headers, body, content_length,
|
|
|
|
|
nullptr, nullptr, content_type, progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"POST", path, headers, body, content_length, nullptr, nullptr,
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
const std::string &body,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("POST", path, headers, body.data(),
|
|
|
|
|
body.size(), nullptr, nullptr, content_type,
|
|
|
|
|
progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"POST", path, headers, body.data(), body.size(), nullptr, nullptr,
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
@@ -9882,18 +9952,40 @@ inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("POST", path, headers, nullptr,
|
|
|
|
|
content_length, std::move(content_provider),
|
|
|
|
|
nullptr, content_type, progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"POST", path, headers, nullptr, content_length,
|
|
|
|
|
std::move(content_provider), nullptr, content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
DownloadProgress progress) {
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"POST", path, headers, nullptr, content_length,
|
|
|
|
|
std::move(content_provider), nullptr, content_type,
|
|
|
|
|
std::move(content_receiver), std::move(progress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("POST", path, headers, nullptr, 0, nullptr,
|
|
|
|
|
std::move(content_provider), content_type,
|
|
|
|
|
progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"POST", path, headers, nullptr, 0, nullptr, std::move(content_provider),
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
DownloadProgress progress) {
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"POST", path, headers, nullptr, 0, nullptr, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), std::move(progress));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
@@ -9903,10 +9995,10 @@ inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
const auto &boundary = detail::make_multipart_data_boundary();
|
|
|
|
|
const auto &content_type =
|
|
|
|
|
detail::serialize_multipart_formdata_get_content_type(boundary);
|
|
|
|
|
return send_with_content_provider(
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"POST", path, headers, nullptr, 0, nullptr,
|
|
|
|
|
get_multipart_content_provider(boundary, items, provider_items),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Post(const std::string &path, const Headers &headers,
|
|
|
|
@@ -9968,6 +10060,15 @@ inline Result ClientImpl::Put(const std::string &path, size_t content_length,
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return Put(path, Headers(), content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
@@ -9976,6 +10077,15 @@ inline Result ClientImpl::Put(const std::string &path,
|
|
|
|
|
progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return Put(path, Headers(), std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
const Params ¶ms) {
|
|
|
|
|
auto query = detail::params_to_query_str(params);
|
|
|
|
@@ -10016,17 +10126,18 @@ inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
const char *body, size_t content_length,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PUT", path, headers, body, content_length,
|
|
|
|
|
nullptr, nullptr, content_type, progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PUT", path, headers, body, content_length, nullptr, nullptr,
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
const std::string &body,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PUT", path, headers, body.data(),
|
|
|
|
|
body.size(), nullptr, nullptr, content_type,
|
|
|
|
|
progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PUT", path, headers, body.data(), body.size(), nullptr, nullptr,
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
@@ -10034,18 +10145,40 @@ inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PUT", path, headers, nullptr,
|
|
|
|
|
content_length, std::move(content_provider),
|
|
|
|
|
nullptr, content_type, progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PUT", path, headers, nullptr, content_length,
|
|
|
|
|
std::move(content_provider), nullptr, content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PUT", path, headers, nullptr, content_length,
|
|
|
|
|
std::move(content_provider), nullptr, content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PUT", path, headers, nullptr, 0, nullptr,
|
|
|
|
|
std::move(content_provider), content_type,
|
|
|
|
|
progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PUT", path, headers, nullptr, 0, nullptr, std::move(content_provider),
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PUT", path, headers, nullptr, 0, nullptr, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
@@ -10055,10 +10188,10 @@ inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
const auto &boundary = detail::make_multipart_data_boundary();
|
|
|
|
|
const auto &content_type =
|
|
|
|
|
detail::serialize_multipart_formdata_get_content_type(boundary);
|
|
|
|
|
return send_with_content_provider(
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PUT", path, headers, nullptr, 0, nullptr,
|
|
|
|
|
get_multipart_content_provider(boundary, items, provider_items),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Put(const std::string &path, const Headers &headers,
|
|
|
|
@@ -10122,6 +10255,15 @@ inline Result ClientImpl::Patch(const std::string &path, size_t content_length,
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return Patch(path, Headers(), content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
@@ -10130,6 +10272,15 @@ inline Result ClientImpl::Patch(const std::string &path,
|
|
|
|
|
progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return Patch(path, Headers(), std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
const Params ¶ms) {
|
|
|
|
|
auto query = detail::params_to_query_str(params);
|
|
|
|
@@ -10170,18 +10321,18 @@ inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
const char *body, size_t content_length,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PATCH", path, headers, body,
|
|
|
|
|
content_length, nullptr, nullptr,
|
|
|
|
|
content_type, progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PATCH", path, headers, body, content_length, nullptr, nullptr,
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
const std::string &body,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PATCH", path, headers, body.data(),
|
|
|
|
|
body.size(), nullptr, nullptr, content_type,
|
|
|
|
|
progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PATCH", path, headers, body.data(), body.size(), nullptr, nullptr,
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
@@ -10189,18 +10340,40 @@ inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PATCH", path, headers, nullptr,
|
|
|
|
|
content_length, std::move(content_provider),
|
|
|
|
|
nullptr, content_type, progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PATCH", path, headers, nullptr, content_length,
|
|
|
|
|
std::move(content_provider), nullptr, content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PATCH", path, headers, nullptr, content_length,
|
|
|
|
|
std::move(content_provider), nullptr, content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider("PATCH", path, headers, nullptr, 0, nullptr,
|
|
|
|
|
std::move(content_provider), content_type,
|
|
|
|
|
progress);
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PATCH", path, headers, nullptr, 0, nullptr, std::move(content_provider),
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PATCH", path, headers, nullptr, 0, nullptr, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
@@ -10210,10 +10383,10 @@ inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
const auto &boundary = detail::make_multipart_data_boundary();
|
|
|
|
|
const auto &content_type =
|
|
|
|
|
detail::serialize_multipart_formdata_get_content_type(boundary);
|
|
|
|
|
return send_with_content_provider(
|
|
|
|
|
return send_with_content_provider_and_receiver(
|
|
|
|
|
"PATCH", path, headers, nullptr, 0, nullptr,
|
|
|
|
|
get_multipart_content_provider(boundary, items, provider_items),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
content_type, nullptr, progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result ClientImpl::Patch(const std::string &path, const Headers &headers,
|
|
|
|
@@ -11605,12 +11778,28 @@ inline Result Client::Post(const std::string &path, size_t content_length,
|
|
|
|
|
return cli_->Post(path, content_length, std::move(content_provider),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Post(path, content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Post(path, std::move(content_provider), content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Post(path, std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
@@ -11619,6 +11808,15 @@ inline Result Client::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
return cli_->Post(path, headers, content_length, std::move(content_provider),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
DownloadProgress progress) {
|
|
|
|
|
return cli_->Post(path, headers, content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
@@ -11626,6 +11824,14 @@ inline Result Client::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
return cli_->Post(path, headers, std::move(content_provider), content_type,
|
|
|
|
|
progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
DownloadProgress progress) {
|
|
|
|
|
return cli_->Post(path, headers, std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Post(const std::string &path, const Params ¶ms) {
|
|
|
|
|
return cli_->Post(path, params);
|
|
|
|
|
}
|
|
|
|
@@ -11660,8 +11866,8 @@ inline Result Client::Post(const std::string &path, const Headers &headers,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
DownloadProgress progress) {
|
|
|
|
|
return cli_->Post(path, headers, body, content_type, content_receiver,
|
|
|
|
|
progress);
|
|
|
|
|
return cli_->Post(path, headers, body, content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline Result Client::Put(const std::string &path) { return cli_->Put(path); }
|
|
|
|
@@ -11698,12 +11904,28 @@ inline Result Client::Put(const std::string &path, size_t content_length,
|
|
|
|
|
return cli_->Put(path, content_length, std::move(content_provider),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Put(path, content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Put(path, std::move(content_provider), content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Put(path, std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
@@ -11712,6 +11934,15 @@ inline Result Client::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
return cli_->Put(path, headers, content_length, std::move(content_provider),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Put(path, headers, content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
@@ -11719,6 +11950,14 @@ inline Result Client::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
return cli_->Put(path, headers, std::move(content_provider), content_type,
|
|
|
|
|
progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Put(path, headers, std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Put(const std::string &path, const Params ¶ms) {
|
|
|
|
|
return cli_->Put(path, params);
|
|
|
|
|
}
|
|
|
|
@@ -11794,12 +12033,28 @@ inline Result Client::Patch(const std::string &path, size_t content_length,
|
|
|
|
|
return cli_->Patch(path, content_length, std::move(content_provider),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path, size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Patch(path, content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Patch(path, std::move(content_provider), content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Patch(path, std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
@@ -11808,6 +12063,15 @@ inline Result Client::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
return cli_->Patch(path, headers, content_length, std::move(content_provider),
|
|
|
|
|
content_type, progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
size_t content_length,
|
|
|
|
|
ContentProvider content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Patch(path, headers, content_length, std::move(content_provider),
|
|
|
|
|
content_type, std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
@@ -11815,6 +12079,14 @@ inline Result Client::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
return cli_->Patch(path, headers, std::move(content_provider), content_type,
|
|
|
|
|
progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path, const Headers &headers,
|
|
|
|
|
ContentProviderWithoutLength content_provider,
|
|
|
|
|
const std::string &content_type,
|
|
|
|
|
ContentReceiver content_receiver,
|
|
|
|
|
UploadProgress progress) {
|
|
|
|
|
return cli_->Patch(path, headers, std::move(content_provider), content_type,
|
|
|
|
|
std::move(content_receiver), progress);
|
|
|
|
|
}
|
|
|
|
|
inline Result Client::Patch(const std::string &path, const Params ¶ms) {
|
|
|
|
|
return cli_->Patch(path, params);
|
|
|
|
|
}
|
|
|
|
|