mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 09:43:51 +00:00
Fix #628
This commit is contained in:
parent
3e4567bae8
commit
3e80666a74
57
httplib.h
57
httplib.h
@ -5071,7 +5071,8 @@ inline Result ClientImpl::Get(const char *path, const Headers &headers,
|
|||||||
req.progress = std::move(progress);
|
req.progress = std::move(progress);
|
||||||
|
|
||||||
auto res = std::make_shared<Response>();
|
auto res = std::make_shared<Response>();
|
||||||
return Result{send(req, *res) ? res : nullptr, get_last_error()};
|
auto ret = send(req, *res);
|
||||||
|
return Result{ret ? res : nullptr, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Get(const char *path,
|
inline Result ClientImpl::Get(const char *path,
|
||||||
@ -5134,7 +5135,8 @@ inline Result ClientImpl::Get(const char *path, const Headers &headers,
|
|||||||
req.progress = std::move(progress);
|
req.progress = std::move(progress);
|
||||||
|
|
||||||
auto res = std::make_shared<Response>();
|
auto res = std::make_shared<Response>();
|
||||||
return Result{send(req, *res) ? res : nullptr, get_last_error()};
|
auto ret = send(req, *res);
|
||||||
|
return Result{ret ? res : nullptr, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Head(const char *path) {
|
inline Result ClientImpl::Head(const char *path) {
|
||||||
@ -5149,7 +5151,8 @@ inline Result ClientImpl::Head(const char *path, const Headers &headers) {
|
|||||||
req.path = path;
|
req.path = path;
|
||||||
|
|
||||||
auto res = std::make_shared<Response>();
|
auto res = std::make_shared<Response>();
|
||||||
return Result{send(req, *res) ? res : nullptr, get_last_error()};
|
auto ret = send(req, *res);
|
||||||
|
return Result{ret ? res : nullptr, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Post(const char *path) {
|
inline Result ClientImpl::Post(const char *path) {
|
||||||
@ -5164,9 +5167,9 @@ inline Result ClientImpl::Post(const char *path, const std::string &body,
|
|||||||
inline Result ClientImpl::Post(const char *path, const Headers &headers,
|
inline Result ClientImpl::Post(const char *path, const Headers &headers,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type) {
|
const char *content_type) {
|
||||||
return Result{send_with_content_provider("POST", path, headers, body, 0,
|
auto ret = send_with_content_provider("POST", path, headers, body, 0, nullptr,
|
||||||
nullptr, content_type),
|
content_type);
|
||||||
get_last_error()};
|
return Result{ret, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Post(const char *path, const Params ¶ms) {
|
inline Result ClientImpl::Post(const char *path, const Params ¶ms) {
|
||||||
@ -5183,10 +5186,10 @@ inline Result ClientImpl::Post(const char *path, const Headers &headers,
|
|||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type) {
|
const char *content_type) {
|
||||||
return Result{send_with_content_provider("POST", path, headers, std::string(),
|
auto ret = send_with_content_provider("POST", path, headers, std::string(),
|
||||||
content_length, content_provider,
|
content_length, content_provider,
|
||||||
content_type),
|
content_type);
|
||||||
get_last_error()};
|
return Result{ret, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Post(const char *path, const Headers &headers,
|
inline Result ClientImpl::Post(const char *path, const Headers &headers,
|
||||||
@ -5238,9 +5241,9 @@ inline Result ClientImpl::Put(const char *path, const std::string &body,
|
|||||||
inline Result ClientImpl::Put(const char *path, const Headers &headers,
|
inline Result ClientImpl::Put(const char *path, const Headers &headers,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type) {
|
const char *content_type) {
|
||||||
return Result{send_with_content_provider("PUT", path, headers, body, 0,
|
auto ret = send_with_content_provider("PUT", path, headers, body, 0, nullptr,
|
||||||
nullptr, content_type),
|
content_type);
|
||||||
get_last_error()};
|
return Result{ret, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Put(const char *path, size_t content_length,
|
inline Result ClientImpl::Put(const char *path, size_t content_length,
|
||||||
@ -5253,10 +5256,10 @@ inline Result ClientImpl::Put(const char *path, const Headers &headers,
|
|||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type) {
|
const char *content_type) {
|
||||||
return Result{send_with_content_provider("PUT", path, headers, std::string(),
|
auto ret = send_with_content_provider("PUT", path, headers, std::string(),
|
||||||
content_length, content_provider,
|
content_length, content_provider,
|
||||||
content_type),
|
content_type);
|
||||||
get_last_error()};
|
return Result{ret, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Put(const char *path, const Params ¶ms) {
|
inline Result ClientImpl::Put(const char *path, const Params ¶ms) {
|
||||||
@ -5277,9 +5280,9 @@ inline Result ClientImpl::Patch(const char *path, const std::string &body,
|
|||||||
inline Result ClientImpl::Patch(const char *path, const Headers &headers,
|
inline Result ClientImpl::Patch(const char *path, const Headers &headers,
|
||||||
const std::string &body,
|
const std::string &body,
|
||||||
const char *content_type) {
|
const char *content_type) {
|
||||||
return Result{send_with_content_provider("PATCH", path, headers, body, 0,
|
auto ret = send_with_content_provider("PATCH", path, headers, body, 0,
|
||||||
nullptr, content_type),
|
nullptr, content_type);
|
||||||
get_last_error()};
|
return Result{ret, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Patch(const char *path, size_t content_length,
|
inline Result ClientImpl::Patch(const char *path, size_t content_length,
|
||||||
@ -5292,10 +5295,10 @@ inline Result ClientImpl::Patch(const char *path, const Headers &headers,
|
|||||||
size_t content_length,
|
size_t content_length,
|
||||||
ContentProvider content_provider,
|
ContentProvider content_provider,
|
||||||
const char *content_type) {
|
const char *content_type) {
|
||||||
return Result{send_with_content_provider("PATCH", path, headers,
|
auto ret = send_with_content_provider("PATCH", path, headers, std::string(),
|
||||||
std::string(), content_length,
|
content_length, content_provider,
|
||||||
content_provider, content_type),
|
content_type);
|
||||||
get_last_error()};
|
return Result{ret, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Delete(const char *path) {
|
inline Result ClientImpl::Delete(const char *path) {
|
||||||
@ -5324,7 +5327,8 @@ inline Result ClientImpl::Delete(const char *path, const Headers &headers,
|
|||||||
req.body = body;
|
req.body = body;
|
||||||
|
|
||||||
auto res = std::make_shared<Response>();
|
auto res = std::make_shared<Response>();
|
||||||
return Result{send(req, *res) ? res : nullptr, get_last_error()};
|
auto ret = send(req, *res);
|
||||||
|
return Result{ret ? res : nullptr, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Result ClientImpl::Options(const char *path) {
|
inline Result ClientImpl::Options(const char *path) {
|
||||||
@ -5339,7 +5343,8 @@ inline Result ClientImpl::Options(const char *path, const Headers &headers) {
|
|||||||
req.path = path;
|
req.path = path;
|
||||||
|
|
||||||
auto res = std::make_shared<Response>();
|
auto res = std::make_shared<Response>();
|
||||||
return Result{send(req, *res) ? res : nullptr, get_last_error()};
|
auto ret = send(req, *res);
|
||||||
|
return Result{ret ? res : nullptr, get_last_error()};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t ClientImpl::is_socket_open() const {
|
inline size_t ClientImpl::is_socket_open() const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user