mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Update CPR.
This commit is contained in:
parent
425b13afe0
commit
a152fd2600
2
vendor/CPR/CMakeLists.txt
vendored
2
vendor/CPR/CMakeLists.txt
vendored
@ -12,6 +12,7 @@ add_library(CPR STATIC
|
||||
cpr/parameters.cpp
|
||||
cpr/payload.cpp
|
||||
cpr/proxies.cpp
|
||||
cpr/proxyauth.cpp
|
||||
cpr/session.cpp
|
||||
cpr/timeout.cpp
|
||||
cpr/unix_socket.cpp
|
||||
@ -36,6 +37,7 @@ add_library(CPR STATIC
|
||||
include/cpr/parameters.h
|
||||
include/cpr/payload.h
|
||||
include/cpr/proxies.h
|
||||
include/cpr/proxyauth.h
|
||||
include/cpr/response.h
|
||||
include/cpr/session.h
|
||||
include/cpr/ssl_options.h
|
||||
|
2
vendor/CPR/cpr/curlholder.cpp
vendored
2
vendor/CPR/cpr/curlholder.cpp
vendored
@ -25,9 +25,9 @@ CurlHolder::CurlHolder() {
|
||||
} // namespace cpr
|
||||
|
||||
CurlHolder::~CurlHolder() {
|
||||
curl_easy_cleanup(handle);
|
||||
curl_slist_free_all(chunk);
|
||||
curl_formfree(formpost);
|
||||
curl_easy_cleanup(handle);
|
||||
}
|
||||
|
||||
std::string CurlHolder::urlEncode(const std::string& s) const {
|
||||
|
2
vendor/CPR/cpr/multipart.cpp
vendored
2
vendor/CPR/cpr/multipart.cpp
vendored
@ -1,5 +1,5 @@
|
||||
#include "cpr/multipart.h"
|
||||
|
||||
namespace cpr {
|
||||
Multipart::Multipart(const std::initializer_list<Part>& parts) : parts{parts} {}
|
||||
Multipart::Multipart(const std::initializer_list<Part>& p_parts) : parts{p_parts} {}
|
||||
} // namespace cpr
|
||||
|
17
vendor/CPR/cpr/proxyauth.cpp
vendored
Normal file
17
vendor/CPR/cpr/proxyauth.cpp
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
#include "cpr/proxyauth.h"
|
||||
|
||||
namespace cpr {
|
||||
const char* EncodedAuthentication::GetAuthString() const noexcept {
|
||||
return auth_string_.c_str();
|
||||
}
|
||||
|
||||
bool ProxyAuthentication::has(const std::string& protocol) const {
|
||||
return proxyAuth_.count(protocol) > 0;
|
||||
}
|
||||
|
||||
const char* ProxyAuthentication::operator[](const std::string& protocol) {
|
||||
return proxyAuth_[protocol].GetAuthString();
|
||||
;
|
||||
}
|
||||
|
||||
} // namespace cpr
|
125
vendor/CPR/cpr/session.cpp
vendored
125
vendor/CPR/cpr/session.cpp
vendored
@ -44,6 +44,8 @@ class Session::Impl {
|
||||
void SetPayload(const Payload& payload);
|
||||
void SetProxies(Proxies&& proxies);
|
||||
void SetProxies(const Proxies& proxies);
|
||||
void SetProxyAuth(ProxyAuthentication&& proxy_auth);
|
||||
void SetProxyAuth(const ProxyAuthentication& proxy_auth);
|
||||
void SetMultipart(Multipart&& multipart);
|
||||
void SetMultipart(const Multipart& multipart);
|
||||
void SetNTLM(const NTLM& auth);
|
||||
@ -76,6 +78,15 @@ class Session::Impl {
|
||||
|
||||
std::shared_ptr<CurlHolder> GetCurlHolder();
|
||||
|
||||
void PrepareDelete();
|
||||
void PrepareGet();
|
||||
void PrepareHead();
|
||||
void PrepareOptions();
|
||||
void PreparePatch();
|
||||
void PreparePost();
|
||||
void PreparePut();
|
||||
Response Complete(CURLcode curl_error);
|
||||
|
||||
private:
|
||||
void SetHeaderInternal();
|
||||
bool hasBodyOrPayload_{false};
|
||||
@ -84,6 +95,7 @@ class Session::Impl {
|
||||
Url url_;
|
||||
Parameters parameters_;
|
||||
Proxies proxies_;
|
||||
ProxyAuthentication proxyAuth_;
|
||||
Header header_;
|
||||
/**
|
||||
* Will be set by the read callback.
|
||||
@ -96,10 +108,12 @@ class Session::Impl {
|
||||
WriteCallback writecb_;
|
||||
ProgressCallback progresscb_;
|
||||
DebugCallback debugcb_;
|
||||
std::string response_string_;
|
||||
std::string header_string_;
|
||||
|
||||
Response makeDownloadRequest();
|
||||
Response makeRequest();
|
||||
static void freeHolder(CurlHolder* holder);
|
||||
void prepareCommon();
|
||||
};
|
||||
|
||||
Session::Impl::Impl() : curl_(new CurlHolder()) {
|
||||
@ -239,6 +253,14 @@ void Session::Impl::SetProxies(Proxies&& proxies) {
|
||||
proxies_ = std::move(proxies);
|
||||
}
|
||||
|
||||
void Session::Impl::SetProxyAuth(ProxyAuthentication&& proxy_auth) {
|
||||
proxyAuth_ = std::move(proxy_auth);
|
||||
}
|
||||
|
||||
void Session::Impl::SetProxyAuth(const ProxyAuthentication& proxy_auth) {
|
||||
proxyAuth_ = proxy_auth;
|
||||
}
|
||||
|
||||
void Session::Impl::SetMultipart(Multipart&& multipart) {
|
||||
curl_httppost* formpost = nullptr;
|
||||
curl_httppost* lastptr = nullptr;
|
||||
@ -413,6 +435,9 @@ void Session::Impl::SetSslOptions(const SslOptions& options) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_KEYPASSWD, options.key_pass.c_str());
|
||||
}
|
||||
}
|
||||
if (!options.pinned_public_key.empty()) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PINNEDPUBLICKEY, options.pinned_public_key.c_str());
|
||||
}
|
||||
#if SUPPORT_ALPN
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_SSL_ENABLE_ALPN, options.enable_alpn ? ON : OFF);
|
||||
#endif
|
||||
@ -459,11 +484,15 @@ void Session::Impl::SetSslOptions(const SslOptions& options) {
|
||||
#endif
|
||||
}
|
||||
|
||||
Response Session::Impl::Delete() {
|
||||
void Session::Impl::PrepareDelete() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_HTTPGET, 0L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 0L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||
prepareCommon();
|
||||
}
|
||||
|
||||
Response Session::Impl::Delete() {
|
||||
PrepareDelete();
|
||||
return makeRequest();
|
||||
}
|
||||
|
||||
@ -485,7 +514,7 @@ Response Session::Impl::Download(std::ofstream& file) {
|
||||
return makeDownloadRequest();
|
||||
}
|
||||
|
||||
Response Session::Impl::Get() {
|
||||
void Session::Impl::PrepareGet() {
|
||||
// In case there is a body or payload for this request, we create a custom GET-Request since a
|
||||
// GET-Request with body is based on the HTTP RFC **not** a leagal request.
|
||||
if (hasBodyOrPayload_) {
|
||||
@ -496,32 +525,48 @@ Response Session::Impl::Get() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, nullptr);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_HTTPGET, 1L);
|
||||
}
|
||||
prepareCommon();
|
||||
}
|
||||
|
||||
Response Session::Impl::Get() {
|
||||
PrepareGet();
|
||||
return makeRequest();
|
||||
}
|
||||
|
||||
void Session::Impl::PrepareHead() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 1L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, nullptr);
|
||||
prepareCommon();
|
||||
}
|
||||
|
||||
Response Session::Impl::Head() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 1L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, nullptr);
|
||||
|
||||
PrepareHead();
|
||||
return makeRequest();
|
||||
}
|
||||
|
||||
void Session::Impl::PrepareOptions() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 0L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, "OPTIONS");
|
||||
prepareCommon();
|
||||
}
|
||||
|
||||
Response Session::Impl::Options() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 0L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, "OPTIONS");
|
||||
|
||||
PrepareOptions();
|
||||
return makeRequest();
|
||||
}
|
||||
|
||||
void Session::Impl::PreparePatch() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 0L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||
prepareCommon();
|
||||
}
|
||||
|
||||
Response Session::Impl::Patch() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 0L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, "PATCH");
|
||||
|
||||
PreparePatch();
|
||||
return makeRequest();
|
||||
}
|
||||
|
||||
Response Session::Impl::Post() {
|
||||
void Session::Impl::PreparePost() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 0L);
|
||||
|
||||
// In case there is no body or payload set it to an empty post:
|
||||
@ -531,14 +576,22 @@ Response Session::Impl::Post() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_POSTFIELDS, readcb_.callback ? nullptr : "");
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
}
|
||||
prepareCommon();
|
||||
}
|
||||
|
||||
Response Session::Impl::Post() {
|
||||
PreparePost();
|
||||
return makeRequest();
|
||||
}
|
||||
|
||||
Response Session::Impl::Put() {
|
||||
void Session::Impl::PreparePut() {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_NOBODY, 0L);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||
prepareCommon();
|
||||
}
|
||||
|
||||
Response Session::Impl::Put() {
|
||||
PreparePut();
|
||||
return makeRequest();
|
||||
}
|
||||
|
||||
@ -559,6 +612,10 @@ Response Session::Impl::makeDownloadRequest() {
|
||||
std::string protocol = url_.str().substr(0, url_.str().find(':'));
|
||||
if (proxies_.has(protocol)) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXY, proxies_[protocol].c_str());
|
||||
if (proxyAuth_.has(protocol)) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXYUSERPWD, proxyAuth_[protocol]);
|
||||
}
|
||||
} else {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXY, "");
|
||||
}
|
||||
@ -586,7 +643,7 @@ Response Session::Impl::makeDownloadRequest() {
|
||||
Error(curl_error, std::move(errorMsg)));
|
||||
}
|
||||
|
||||
Response Session::Impl::makeRequest() {
|
||||
void Session::Impl::prepareCommon() {
|
||||
assert(curl_->handle);
|
||||
|
||||
// Set Header:
|
||||
@ -604,6 +661,10 @@ Response Session::Impl::makeRequest() {
|
||||
std::string protocol = url_.str().substr(0, url_.str().find(':'));
|
||||
if (proxies_.has(protocol)) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXY, proxies_[protocol].c_str());
|
||||
if (proxyAuth_.has(protocol)) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXYUSERPWD, proxyAuth_[protocol]);
|
||||
}
|
||||
} else {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_PROXY, nullptr);
|
||||
}
|
||||
@ -624,22 +685,29 @@ Response Session::Impl::makeRequest() {
|
||||
|
||||
curl_->error[0] = '\0';
|
||||
|
||||
std::string response_string;
|
||||
std::string header_string;
|
||||
response_string_.clear();
|
||||
header_string_.clear();
|
||||
if (!this->writecb_.callback) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_WRITEFUNCTION, cpr::util::writeFunction);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_WRITEDATA, &response_string);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_WRITEDATA, &response_string_);
|
||||
}
|
||||
if (!this->headercb_.callback) {
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_HEADERFUNCTION, cpr::util::writeFunction);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_HEADERDATA, &header_string);
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_HEADERDATA, &header_string_);
|
||||
}
|
||||
|
||||
// Enable so we are able to retrive certificate information:
|
||||
curl_easy_setopt(curl_->handle, CURLOPT_CERTINFO, 1L);
|
||||
}
|
||||
|
||||
Response Session::Impl::makeRequest()
|
||||
{
|
||||
CURLcode curl_error = curl_easy_perform(curl_->handle);
|
||||
return Complete(curl_error);
|
||||
}
|
||||
|
||||
Response Session::Impl::Complete(CURLcode curl_error)
|
||||
{
|
||||
curl_slist* raw_cookies{nullptr};
|
||||
curl_easy_getinfo(curl_->handle, CURLINFO_COOKIELIST, &raw_cookies);
|
||||
Cookies cookies = util::parseCookies(raw_cookies);
|
||||
@ -649,17 +717,20 @@ Response Session::Impl::makeRequest() {
|
||||
hasBodyOrPayload_ = false;
|
||||
|
||||
std::string errorMsg = curl_->error.data();
|
||||
return Response(curl_, std::move(response_string), std::move(header_string), std::move(cookies),
|
||||
return Response(curl_, std::move(response_string_), std::move(header_string_), std::move(cookies),
|
||||
Error(curl_error, std::move(errorMsg)));
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
Session::Session() : pimpl_(new Impl()) {}
|
||||
Session::Session(Session&& old) noexcept = default;
|
||||
Session::~Session() = default;
|
||||
Session& Session::operator=(Session&& old) noexcept = default;
|
||||
void Session::SetReadCallback(const ReadCallback& read) { pimpl_->SetReadCallback(read); }
|
||||
void Session::SetHeaderCallback(const HeaderCallback& header) { pimpl_->SetHeaderCallback(header); }
|
||||
void Session::SetWriteCallback(const WriteCallback& write) { pimpl_->SetWriteCallback(write); }
|
||||
void Session::SetProgressCallback(const ProgressCallback& progress) { pimpl_->SetProgressCallback(progress); }
|
||||
void Session::SetDebugCallback(const DebugCallback& debug) { pimpl_->SetDebugCallback(debug); }
|
||||
void Session::SetUrl(const Url& url) { pimpl_->SetUrl(url); }
|
||||
void Session::SetParameters(const Parameters& parameters) { pimpl_->SetParameters(parameters); }
|
||||
void Session::SetParameters(Parameters&& parameters) { pimpl_->SetParameters(std::move(parameters)); }
|
||||
@ -674,6 +745,8 @@ void Session::SetPayload(const Payload& payload) { pimpl_->SetPayload(payload);
|
||||
void Session::SetPayload(Payload&& payload) { pimpl_->SetPayload(std::move(payload)); }
|
||||
void Session::SetProxies(const Proxies& proxies) { pimpl_->SetProxies(proxies); }
|
||||
void Session::SetProxies(Proxies&& proxies) { pimpl_->SetProxies(std::move(proxies)); }
|
||||
void Session::SetProxyAuth(ProxyAuthentication&& proxy_auth) { pimpl_->SetProxyAuth(std::move(proxy_auth)); }
|
||||
void Session::SetProxyAuth(const ProxyAuthentication& proxy_auth) { pimpl_->SetProxyAuth(proxy_auth); }
|
||||
void Session::SetMultipart(const Multipart& multipart) { pimpl_->SetMultipart(multipart); }
|
||||
void Session::SetMultipart(Multipart&& multipart) { pimpl_->SetMultipart(std::move(multipart)); }
|
||||
void Session::SetNTLM(const NTLM& auth) { pimpl_->SetNTLM(auth); }
|
||||
@ -711,6 +784,8 @@ void Session::SetOption(const Payload& payload) { pimpl_->SetPayload(payload); }
|
||||
void Session::SetOption(Payload&& payload) { pimpl_->SetPayload(std::move(payload)); }
|
||||
void Session::SetOption(const Proxies& proxies) { pimpl_->SetProxies(proxies); }
|
||||
void Session::SetOption(Proxies&& proxies) { pimpl_->SetProxies(std::move(proxies)); }
|
||||
void Session::SetOption(ProxyAuthentication&& proxy_auth) { pimpl_->SetProxyAuth(std::move(proxy_auth)); }
|
||||
void Session::SetOption(const ProxyAuthentication& proxy_auth) { pimpl_->SetProxyAuth(proxy_auth); }
|
||||
void Session::SetOption(const Multipart& multipart) { pimpl_->SetMultipart(multipart); }
|
||||
void Session::SetOption(Multipart&& multipart) { pimpl_->SetMultipart(std::move(multipart)); }
|
||||
void Session::SetOption(const NTLM& auth) { pimpl_->SetNTLM(auth); }
|
||||
@ -736,5 +811,15 @@ Response Session::Post() { return pimpl_->Post(); }
|
||||
Response Session::Put() { return pimpl_->Put(); }
|
||||
|
||||
std::shared_ptr<CurlHolder> Session::GetCurlHolder() { return pimpl_->GetCurlHolder(); }
|
||||
|
||||
void Session::PrepareDelete() { return pimpl_->PrepareDelete(); }
|
||||
void Session::PrepareGet() { return pimpl_->PrepareGet(); }
|
||||
void Session::PrepareHead() { return pimpl_->PrepareHead(); }
|
||||
void Session::PrepareOptions() { return pimpl_->PrepareOptions(); }
|
||||
void Session::PreparePatch() { return pimpl_->PreparePatch(); }
|
||||
void Session::PreparePost() { return pimpl_->PreparePost(); }
|
||||
void Session::PreparePut() { return pimpl_->PreparePut(); }
|
||||
Response Session::Complete( CURLcode curl_error ) { return pimpl_->Complete(curl_error); }
|
||||
|
||||
// clang-format on
|
||||
} // namespace cpr
|
||||
|
41
vendor/CPR/include/cpr/api.h
vendored
41
vendor/CPR/include/cpr/api.h
vendored
@ -24,15 +24,10 @@ using AsyncResponse = std::future<Response>;
|
||||
|
||||
namespace priv {
|
||||
|
||||
template <typename T>
|
||||
void set_option(Session& session, T&& t) {
|
||||
session.SetOption(std::forward<T>(t));
|
||||
}
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
void set_option(Session& session, T&& t, Ts&&... ts) {
|
||||
set_option(session, std::forward<T>(t));
|
||||
set_option(session, std::forward<Ts>(ts)...);
|
||||
template <typename... Ts>
|
||||
void set_option(Session& session, Ts&&... ts) {
|
||||
std::initializer_list<int> ignore = { (session.SetOption(std::forward<Ts>(ts)), 0)... };
|
||||
(void)ignore;
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
@ -49,7 +44,7 @@ Response Get(Ts&&... ts) {
|
||||
template <typename... Ts>
|
||||
AsyncResponse GetAsync(Ts... ts) {
|
||||
return std::async(
|
||||
std::launch::async, [](Ts... ts) { return Get(std::move(ts)...); }, std::move(ts)...);
|
||||
std::launch::async, [](Ts... ts_inner) { return Get(std::move(ts_inner)...); }, std::move(ts)...);
|
||||
}
|
||||
|
||||
// Get callback methods
|
||||
@ -57,7 +52,7 @@ template <typename Then, typename... Ts>
|
||||
// NOLINTNEXTLINE(fuchsia-trailing-return)
|
||||
auto GetCallback(Then then, Ts... ts) -> std::future<decltype(then(Get(std::move(ts)...)))> {
|
||||
return std::async(
|
||||
std::launch::async, [](Then then, Ts... ts) { return then(Get(std::move(ts)...)); },
|
||||
std::launch::async, [](Then then_inner, Ts... ts_inner) { return then_inner(Get(std::move(ts_inner)...)); },
|
||||
std::move(then), std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -73,7 +68,7 @@ Response Post(Ts&&... ts) {
|
||||
template <typename... Ts>
|
||||
AsyncResponse PostAsync(Ts... ts) {
|
||||
return std::async(
|
||||
std::launch::async, [](Ts... ts) { return Post(std::move(ts)...); }, std::move(ts)...);
|
||||
std::launch::async, [](Ts... ts_inner) { return Post(std::move(ts_inner)...); }, std::move(ts)...);
|
||||
}
|
||||
|
||||
// Post callback methods
|
||||
@ -81,7 +76,7 @@ template <typename Then, typename... Ts>
|
||||
// NOLINTNEXTLINE(fuchsia-trailing-return)
|
||||
auto PostCallback(Then then, Ts... ts) -> std::future<decltype(then(Post(std::move(ts)...)))> {
|
||||
return std::async(
|
||||
std::launch::async, [](Then then, Ts... ts) { return then(Post(std::move(ts)...)); },
|
||||
std::launch::async, [](Then then_inner, Ts... ts_inner) { return then_inner(Post(std::move(ts_inner)...)); },
|
||||
std::move(then), std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -97,7 +92,7 @@ Response Put(Ts&&... ts) {
|
||||
template <typename... Ts>
|
||||
AsyncResponse PutAsync(Ts... ts) {
|
||||
return std::async(
|
||||
std::launch::async, [](Ts... ts) { return Put(std::move(ts)...); }, std::move(ts)...);
|
||||
std::launch::async, [](Ts... ts_inner) { return Put(std::move(ts_inner)...); }, std::move(ts)...);
|
||||
}
|
||||
|
||||
// Put callback methods
|
||||
@ -105,7 +100,7 @@ template <typename Then, typename... Ts>
|
||||
// NOLINTNEXTLINE(fuchsia-trailing-return)
|
||||
auto PutCallback(Then then, Ts... ts) -> std::future<decltype(then(Put(std::move(ts)...)))> {
|
||||
return std::async(
|
||||
std::launch::async, [](Then then, Ts... ts) { return then(Put(std::move(ts)...)); },
|
||||
std::launch::async, [](Then then_inner, Ts... ts_inner) { return then_inner(Put(std::move(ts_inner)...)); },
|
||||
std::move(then), std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -121,7 +116,7 @@ Response Head(Ts&&... ts) {
|
||||
template <typename... Ts>
|
||||
AsyncResponse HeadAsync(Ts... ts) {
|
||||
return std::async(
|
||||
std::launch::async, [](Ts... ts) { return Head(std::move(ts)...); }, std::move(ts)...);
|
||||
std::launch::async, [](Ts... ts_inner) { return Head(std::move(ts_inner)...); }, std::move(ts)...);
|
||||
}
|
||||
|
||||
// Head callback methods
|
||||
@ -129,7 +124,7 @@ template <typename Then, typename... Ts>
|
||||
// NOLINTNEXTLINE(fuchsia-trailing-return)
|
||||
auto HeadCallback(Then then, Ts... ts) -> std::future<decltype(then(Head(std::move(ts)...)))> {
|
||||
return std::async(
|
||||
std::launch::async, [](Then then, Ts... ts) { return then(Head(std::move(ts)...)); },
|
||||
std::launch::async, [](Then then_inner, Ts... ts_inner) { return then_inner(Head(std::move(ts_inner)...)); },
|
||||
std::move(then), std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -145,7 +140,7 @@ Response Delete(Ts&&... ts) {
|
||||
template <typename... Ts>
|
||||
AsyncResponse DeleteAsync(Ts... ts) {
|
||||
return std::async(
|
||||
std::launch::async, [](Ts... ts) { return Delete(std::move(ts)...); },
|
||||
std::launch::async, [](Ts... ts_inner) { return Delete(std::move(ts_inner)...); },
|
||||
std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -154,7 +149,7 @@ template <typename Then, typename... Ts>
|
||||
// NOLINTNEXTLINE(fuchsia-trailing-return)
|
||||
auto DeleteCallback(Then then, Ts... ts) -> std::future<decltype(then(Delete(std::move(ts)...)))> {
|
||||
return std::async(
|
||||
std::launch::async, [](Then then, Ts... ts) { return then(Delete(std::move(ts)...)); },
|
||||
std::launch::async, [](Then then_inner, Ts... ts_inner) { return then_inner(Delete(std::move(ts_inner)...)); },
|
||||
std::move(then), std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -170,7 +165,7 @@ Response Options(Ts&&... ts) {
|
||||
template <typename... Ts>
|
||||
AsyncResponse OptionsAsync(Ts... ts) {
|
||||
return std::async(
|
||||
std::launch::async, [](Ts... ts) { return Options(std::move(ts)...); },
|
||||
std::launch::async, [](Ts... ts_inner) { return Options(std::move(ts_inner)...); },
|
||||
std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -180,7 +175,7 @@ template <typename Then, typename... Ts>
|
||||
auto OptionsCallback(Then then, Ts... ts)
|
||||
-> std::future<decltype(then(Options(std::move(ts)...)))> {
|
||||
return std::async(
|
||||
std::launch::async, [](Then then, Ts... ts) { return then(Options(std::move(ts)...)); },
|
||||
std::launch::async, [](Then then_inner, Ts... ts_inner) { return then_inner(Options(std::move(ts_inner)...)); },
|
||||
std::move(then), std::move(ts)...);
|
||||
}
|
||||
|
||||
@ -196,7 +191,7 @@ Response Patch(Ts&&... ts) {
|
||||
template <typename... Ts>
|
||||
AsyncResponse PatchAsync(Ts... ts) {
|
||||
return std::async(
|
||||
std::launch::async, [](Ts... ts) { return Patch(std::move(ts)...); }, std::move(ts)...);
|
||||
std::launch::async, [](Ts... ts_inner) { return Patch(std::move(ts_inner)...); }, std::move(ts)...);
|
||||
}
|
||||
|
||||
// Patch callback methods
|
||||
@ -204,7 +199,7 @@ template <typename Then, typename... Ts>
|
||||
// NOLINTNEXTLINE(fuchsia-trailing-return)
|
||||
auto PatchCallback(Then then, Ts... ts) -> std::future<decltype(then(Patch(std::move(ts)...)))> {
|
||||
return std::async(
|
||||
std::launch::async, [](Then then, Ts... ts) { return then(Patch(std::move(ts)...)); },
|
||||
std::launch::async, [](Then then_inner, Ts... ts_inner) { return then_inner(Patch(std::move(ts_inner)...)); },
|
||||
std::move(then), std::move(ts)...);
|
||||
}
|
||||
|
||||
|
22
vendor/CPR/include/cpr/callback.h
vendored
22
vendor/CPR/include/cpr/callback.h
vendored
@ -12,10 +12,10 @@ class ReadCallback {
|
||||
public:
|
||||
ReadCallback() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
ReadCallback(std::function<bool(char* buffer, size_t& size)> callback)
|
||||
: size{-1}, callback{std::move(callback)} {}
|
||||
ReadCallback(cpr_off_t size, std::function<bool(char* buffer, size_t& size)> callback)
|
||||
: size{size}, callback{std::move(callback)} {}
|
||||
ReadCallback(std::function<bool(char* buffer, size_t& size)> p_callback)
|
||||
: size{-1}, callback{std::move(p_callback)} {}
|
||||
ReadCallback(cpr_off_t p_size, std::function<bool(char* buffer, size_t& size)> p_callback)
|
||||
: size{p_size}, callback{std::move(p_callback)} {}
|
||||
|
||||
cpr_off_t size{};
|
||||
std::function<bool(char* buffer, size_t& size)> callback;
|
||||
@ -25,8 +25,8 @@ class HeaderCallback {
|
||||
public:
|
||||
HeaderCallback() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
HeaderCallback(std::function<bool(std::string header)> callback)
|
||||
: callback(std::move(callback)) {}
|
||||
HeaderCallback(std::function<bool(std::string header)> p_callback)
|
||||
: callback(std::move(p_callback)) {}
|
||||
|
||||
std::function<bool(std::string header)> callback;
|
||||
};
|
||||
@ -35,7 +35,7 @@ class WriteCallback {
|
||||
public:
|
||||
WriteCallback() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
WriteCallback(std::function<bool(std::string data)> callback) : callback(std::move(callback)) {}
|
||||
WriteCallback(std::function<bool(std::string data)> p_callback) : callback(std::move(p_callback)) {}
|
||||
|
||||
std::function<bool(std::string data)> callback;
|
||||
};
|
||||
@ -46,8 +46,8 @@ class ProgressCallback {
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
ProgressCallback(std::function<bool(size_t downloadTotal, size_t downloadNow,
|
||||
size_t uploadTotal, size_t uploadNow)>
|
||||
callback)
|
||||
: callback(std::move(callback)) {}
|
||||
p_callback)
|
||||
: callback(std::move(p_callback)) {}
|
||||
|
||||
std::function<bool(size_t downloadTotal, size_t downloadNow, size_t uploadTotal,
|
||||
size_t uploadNow)>
|
||||
@ -67,8 +67,8 @@ class DebugCallback {
|
||||
};
|
||||
DebugCallback() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
DebugCallback(std::function<void(InfoType type, std::string data)> callback)
|
||||
: callback(std::move(callback)) {}
|
||||
DebugCallback(std::function<void(InfoType type, std::string data)> p_callback)
|
||||
: callback(std::move(p_callback)) {}
|
||||
|
||||
std::function<void(InfoType type, std::string data)> callback;
|
||||
};
|
||||
|
10
vendor/CPR/include/cpr/cookies.h
vendored
10
vendor/CPR/include/cpr/cookies.h
vendored
@ -25,13 +25,13 @@ class Cookies {
|
||||
bool encode{true};
|
||||
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
Cookies(bool encode = true) : encode(encode) {}
|
||||
Cookies(bool p_encode = true) : encode(p_encode) {}
|
||||
Cookies(const std::initializer_list<std::pair<const std::string, std::string>>& pairs,
|
||||
bool encode = true)
|
||||
: encode(encode), map_{pairs} {}
|
||||
bool p_encode = true)
|
||||
: encode(p_encode), map_{pairs} {}
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
Cookies(const std::map<std::string, std::string>& map, bool encode = true)
|
||||
: encode(encode), map_{map} {}
|
||||
Cookies(const std::map<std::string, std::string>& map, bool p_encode = true)
|
||||
: encode(p_encode), map_{map} {}
|
||||
|
||||
std::string& operator[](const std::string& key);
|
||||
std::string GetEncoded(const CurlHolder& holder) const;
|
||||
|
6
vendor/CPR/include/cpr/curl_container.h
vendored
6
vendor/CPR/include/cpr/curl_container.h
vendored
@ -12,9 +12,9 @@
|
||||
namespace cpr {
|
||||
|
||||
struct Parameter {
|
||||
Parameter(const std::string& key, const std::string& value) : key{key}, value{value} {}
|
||||
Parameter(std::string&& key, std::string&& value)
|
||||
: key{std::move(key)}, value{std::move(value)} {}
|
||||
Parameter(const std::string& p_key, const std::string& p_value) : key{p_key}, value{p_value} {}
|
||||
Parameter(std::string&& p_key, std::string&& p_value)
|
||||
: key{std::move(p_key)}, value{std::move(p_value)} {}
|
||||
|
||||
std::string key;
|
||||
std::string value;
|
||||
|
4
vendor/CPR/include/cpr/limit_rate.h
vendored
4
vendor/CPR/include/cpr/limit_rate.h
vendored
@ -7,8 +7,8 @@ namespace cpr {
|
||||
|
||||
class LimitRate {
|
||||
public:
|
||||
LimitRate(const std::int64_t downrate, const std::int64_t uprate)
|
||||
: downrate(downrate), uprate(uprate) {}
|
||||
LimitRate(const std::int64_t p_downrate, const std::int64_t p_uprate)
|
||||
: downrate(p_downrate), uprate(p_uprate) {}
|
||||
|
||||
std::int64_t downrate = 0;
|
||||
std::int64_t uprate = 0;
|
||||
|
2
vendor/CPR/include/cpr/low_speed.h
vendored
2
vendor/CPR/include/cpr/low_speed.h
vendored
@ -7,7 +7,7 @@ namespace cpr {
|
||||
|
||||
class LowSpeed {
|
||||
public:
|
||||
LowSpeed(const std::int32_t limit, const std::int32_t time) : limit(limit), time(time) {}
|
||||
LowSpeed(const std::int32_t p_limit, const std::int32_t p_time) : limit(p_limit), time(p_time) {}
|
||||
|
||||
std::int32_t limit;
|
||||
std::int32_t time;
|
||||
|
4
vendor/CPR/include/cpr/max_redirects.h
vendored
4
vendor/CPR/include/cpr/max_redirects.h
vendored
@ -7,8 +7,8 @@ namespace cpr {
|
||||
|
||||
class MaxRedirects {
|
||||
public:
|
||||
explicit MaxRedirects(const std::int32_t number_of_redirects)
|
||||
: number_of_redirects(number_of_redirects) {}
|
||||
explicit MaxRedirects(const std::int32_t p_number_of_redirects)
|
||||
: number_of_redirects(p_number_of_redirects) {}
|
||||
|
||||
std::int32_t number_of_redirects;
|
||||
};
|
||||
|
30
vendor/CPR/include/cpr/multipart.h
vendored
30
vendor/CPR/include/cpr/multipart.h
vendored
@ -10,8 +10,8 @@
|
||||
namespace cpr {
|
||||
|
||||
struct File {
|
||||
explicit File(std::string&& filepath) : filepath(std::move(filepath)) {}
|
||||
explicit File(const std::string& filepath) : filepath(filepath) {}
|
||||
explicit File(std::string&& p_filepath) : filepath(std::move(p_filepath)) {}
|
||||
explicit File(const std::string& p_filepath) : filepath(p_filepath) {}
|
||||
const std::string filepath;
|
||||
};
|
||||
|
||||
@ -19,13 +19,13 @@ struct Buffer {
|
||||
using data_t = const unsigned char*;
|
||||
|
||||
template <typename Iterator>
|
||||
Buffer(Iterator begin, Iterator end, std::string&& filename)
|
||||
Buffer(Iterator begin, Iterator end, std::string&& p_filename)
|
||||
// Ignored here since libcurl reqires a long.
|
||||
// There is also no way around the reinterpret_cast.
|
||||
// NOLINTNEXTLINE(google-runtime-int, cppcoreguidelines-pro-type-reinterpret-cast)
|
||||
: data{reinterpret_cast<data_t>(&(*begin))}, datalen{static_cast<long>(
|
||||
std::distance(begin, end))},
|
||||
filename(std::move(filename)) {
|
||||
filename(std::move(p_filename)) {
|
||||
is_random_access_iterator(begin, end);
|
||||
static_assert(sizeof(*begin) == 1, "only byte buffers can be used");
|
||||
}
|
||||
@ -43,17 +43,17 @@ struct Buffer {
|
||||
};
|
||||
|
||||
struct Part {
|
||||
Part(const std::string& name, const std::string& value, const std::string& content_type = {})
|
||||
: name{name}, value{value},
|
||||
content_type{content_type}, is_file{false}, is_buffer{false} {}
|
||||
Part(const std::string& name, const std::int32_t& value, const std::string& content_type = {})
|
||||
: name{name}, value{std::to_string(value)},
|
||||
content_type{content_type}, is_file{false}, is_buffer{false} {}
|
||||
Part(const std::string& name, const File& file, const std::string& content_type = {})
|
||||
: name{name}, value{file.filepath},
|
||||
content_type{content_type}, is_file{true}, is_buffer{false} {}
|
||||
Part(const std::string& name, const Buffer& buffer, const std::string& content_type = {})
|
||||
: name{name}, value{buffer.filename}, content_type{content_type}, data{buffer.data},
|
||||
Part(const std::string& p_name, const std::string& p_value, const std::string& p_content_type = {})
|
||||
: name{p_name}, value{p_value},
|
||||
content_type{p_content_type}, is_file{false}, is_buffer{false} {}
|
||||
Part(const std::string& p_name, const std::int32_t& p_value, const std::string& p_content_type = {})
|
||||
: name{p_name}, value{std::to_string(p_value)},
|
||||
content_type{p_content_type}, is_file{false}, is_buffer{false} {}
|
||||
Part(const std::string& p_name, const File& file, const std::string& p_content_type = {})
|
||||
: name{p_name}, value{file.filepath},
|
||||
content_type{p_content_type}, is_file{true}, is_buffer{false} {}
|
||||
Part(const std::string& p_name, const Buffer& buffer, const std::string& p_content_type = {})
|
||||
: name{p_name}, value{buffer.filename}, content_type{p_content_type}, data{buffer.data},
|
||||
datalen{buffer.datalen}, is_file{false}, is_buffer{true} {}
|
||||
|
||||
std::string name;
|
||||
|
43
vendor/CPR/include/cpr/proxyauth.h
vendored
Normal file
43
vendor/CPR/include/cpr/proxyauth.h
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
#ifndef CPR_PROXYAUTH_H
|
||||
#define CPR_PROXYAUTH_H
|
||||
|
||||
#include <initializer_list>
|
||||
#include <map>
|
||||
|
||||
#include "cpr/auth.h"
|
||||
#include "cpr/util.h"
|
||||
|
||||
namespace cpr {
|
||||
class EncodedAuthentication {
|
||||
public:
|
||||
EncodedAuthentication() : auth_string_{""} {}
|
||||
EncodedAuthentication(const std::string& username, const std::string& password) : auth_string_{cpr::util::urlEncode(username) + ":" + cpr::util::urlEncode(password)} {}
|
||||
EncodedAuthentication(std::string&& username, std::string&& password) : auth_string_{cpr::util::urlEncode(std::move(username)) + ":" + cpr::util::urlEncode(std::move(password))} {}
|
||||
EncodedAuthentication(const EncodedAuthentication& other) = default;
|
||||
EncodedAuthentication(EncodedAuthentication&& old) noexcept = default;
|
||||
virtual ~EncodedAuthentication() noexcept = default;
|
||||
|
||||
EncodedAuthentication& operator=(EncodedAuthentication&& old) noexcept = default;
|
||||
EncodedAuthentication& operator=(const EncodedAuthentication& other) = default;
|
||||
|
||||
const char* GetAuthString() const noexcept;
|
||||
|
||||
protected:
|
||||
std::string auth_string_;
|
||||
};
|
||||
|
||||
class ProxyAuthentication {
|
||||
public:
|
||||
ProxyAuthentication() = default;
|
||||
ProxyAuthentication(const std::initializer_list<std::pair<const std::string, EncodedAuthentication>>& auths) : proxyAuth_{auths} {}
|
||||
|
||||
bool has(const std::string& protocol) const;
|
||||
const char* operator[](const std::string& protocol);
|
||||
|
||||
private:
|
||||
std::map<std::string, EncodedAuthentication> proxyAuth_;
|
||||
};
|
||||
|
||||
} // namespace cpr
|
||||
|
||||
#endif
|
20
vendor/CPR/include/cpr/session.h
vendored
20
vendor/CPR/include/cpr/session.h
vendored
@ -22,6 +22,7 @@
|
||||
#include "cpr/parameters.h"
|
||||
#include "cpr/payload.h"
|
||||
#include "cpr/proxies.h"
|
||||
#include "cpr/proxyauth.h"
|
||||
#include "cpr/response.h"
|
||||
#include "cpr/ssl_options.h"
|
||||
#include "cpr/timeout.h"
|
||||
@ -34,12 +35,12 @@ namespace cpr {
|
||||
class Session {
|
||||
public:
|
||||
Session();
|
||||
Session(Session&& old) noexcept = default;
|
||||
Session(Session&& old) noexcept;
|
||||
Session(const Session& other) = delete;
|
||||
|
||||
~Session();
|
||||
|
||||
Session& operator=(Session&& old) noexcept = default;
|
||||
Session& operator=(Session&& old) noexcept;
|
||||
Session& operator=(const Session& other) = delete;
|
||||
|
||||
void SetUrl(const Url& url);
|
||||
@ -56,6 +57,8 @@ class Session {
|
||||
void SetPayload(const Payload& payload);
|
||||
void SetProxies(Proxies&& proxies);
|
||||
void SetProxies(const Proxies& proxies);
|
||||
void SetProxyAuth(ProxyAuthentication&& proxy_auth);
|
||||
void SetProxyAuth(const ProxyAuthentication& proxy_auth);
|
||||
void SetMultipart(Multipart&& multipart);
|
||||
void SetMultipart(const Multipart& multipart);
|
||||
void SetNTLM(const NTLM& auth);
|
||||
@ -95,6 +98,8 @@ class Session {
|
||||
void SetOption(const LimitRate& limit_rate);
|
||||
void SetOption(Proxies&& proxies);
|
||||
void SetOption(const Proxies& proxies);
|
||||
void SetOption(ProxyAuthentication&& proxy_auth);
|
||||
void SetOption(const ProxyAuthentication& proxy_auth);
|
||||
void SetOption(Multipart&& multipart);
|
||||
void SetOption(const Multipart& multipart);
|
||||
void SetOption(const NTLM& auth);
|
||||
@ -126,7 +131,16 @@ class Session {
|
||||
|
||||
std::shared_ptr<CurlHolder> GetCurlHolder();
|
||||
|
||||
private:
|
||||
void PrepareDelete();
|
||||
void PrepareGet();
|
||||
void PrepareHead();
|
||||
void PrepareOptions();
|
||||
void PreparePatch();
|
||||
void PreparePost();
|
||||
void PreparePut();
|
||||
Response Complete(CURLcode curl_error);
|
||||
|
||||
protected:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> pimpl_;
|
||||
};
|
||||
|
31
vendor/CPR/include/cpr/ssl_options.h
vendored
31
vendor/CPR/include/cpr/ssl_options.h
vendored
@ -70,7 +70,7 @@ class VerifySsl {
|
||||
public:
|
||||
VerifySsl() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
VerifySsl(bool verify) : verify(verify) {}
|
||||
VerifySsl(bool p_verify) : verify(p_verify) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return verify;
|
||||
@ -140,6 +140,14 @@ class DerKey : public KeyFile {
|
||||
}
|
||||
};
|
||||
|
||||
class PinnedPublicKey {
|
||||
public:
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
PinnedPublicKey(std::string&& p_pinned_public_key) : pinned_public_key(std::move(p_pinned_public_key)) {}
|
||||
|
||||
const std::string pinned_public_key;
|
||||
};
|
||||
|
||||
#if SUPPORT_ALPN
|
||||
// This option enables/disables ALPN in the SSL handshake (if the SSL backend libcurl is built to
|
||||
// use supports it), which can be used to negotiate http2.
|
||||
@ -147,7 +155,7 @@ class ALPN {
|
||||
public:
|
||||
ALPN() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
ALPN(bool enabled) : enabled(enabled) {}
|
||||
ALPN(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -164,7 +172,7 @@ class NPN {
|
||||
public:
|
||||
NPN() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
NPN(bool enabled) : enabled(enabled) {}
|
||||
NPN(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -180,7 +188,7 @@ class VerifyHost {
|
||||
public:
|
||||
VerifyHost() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
VerifyHost(bool enabled) : enabled(enabled) {}
|
||||
VerifyHost(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -194,7 +202,7 @@ class VerifyPeer {
|
||||
public:
|
||||
VerifyPeer() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
VerifyPeer(bool enabled) : enabled(enabled) {}
|
||||
VerifyPeer(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -208,7 +216,7 @@ class VerifyPeer {
|
||||
class VerifyStatus {
|
||||
public:
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
VerifyStatus(bool enabled) : enabled(enabled) {}
|
||||
VerifyStatus(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -318,7 +326,7 @@ class SessionIdCache {
|
||||
public:
|
||||
SessionIdCache() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
SessionIdCache(bool enabled) : enabled(enabled) {}
|
||||
SessionIdCache(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -333,7 +341,7 @@ class SslFastStart {
|
||||
public:
|
||||
SslFastStart() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
SslFastStart(bool enabled) : enabled(enabled) {}
|
||||
SslFastStart(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -347,7 +355,7 @@ class NoRevoke {
|
||||
public:
|
||||
NoRevoke() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
NoRevoke(bool enabled) : enabled(enabled) {}
|
||||
NoRevoke(bool p_enabled) : enabled(p_enabled) {}
|
||||
|
||||
explicit operator bool() const {
|
||||
return enabled;
|
||||
@ -364,6 +372,7 @@ struct SslOptions {
|
||||
std::string key_file;
|
||||
std::string key_type;
|
||||
std::string key_pass;
|
||||
std::string pinned_public_key;
|
||||
#if SUPPORT_ALPN
|
||||
bool enable_alpn = true;
|
||||
#endif // SUPPORT_ALPN
|
||||
@ -400,6 +409,10 @@ struct SslOptions {
|
||||
key_type = opt.GetKeyType();
|
||||
key_pass = opt.password;
|
||||
}
|
||||
void SetOption(const ssl::PinnedPublicKey& opt) {
|
||||
pinned_public_key = opt.pinned_public_key;
|
||||
}
|
||||
|
||||
#if SUPPORT_ALPN
|
||||
void SetOption(const ssl::ALPN& opt) {
|
||||
enable_alpn = opt.enabled;
|
||||
|
2
vendor/CPR/include/cpr/verbose.h
vendored
2
vendor/CPR/include/cpr/verbose.h
vendored
@ -7,7 +7,7 @@ class Verbose {
|
||||
public:
|
||||
Verbose() = default;
|
||||
// NOLINTNEXTLINE(google-explicit-constructor, hicpp-explicit-conversions)
|
||||
Verbose(const bool verbose) : verbose{verbose} {}
|
||||
Verbose(const bool p_verbose) : verbose{p_verbose} {}
|
||||
|
||||
bool verbose = true;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user