HTTP: allow CAINFO to be set
Env var is SIMGEAR_TLS_CERT_PATH
This commit is contained in:
committed by
Automatic Release Builder
parent
02cfd941c9
commit
08108d9cf1
@@ -107,6 +107,8 @@ public:
|
|||||||
unsigned int bytesTransferred;
|
unsigned int bytesTransferred;
|
||||||
unsigned int lastTransferRate;
|
unsigned int lastTransferRate;
|
||||||
uint64_t totalBytesDownloaded;
|
uint64_t totalBytesDownloaded;
|
||||||
|
|
||||||
|
SGPath tlsCertificatePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
Client::Client() :
|
Client::Client() :
|
||||||
@@ -122,6 +124,8 @@ Client::Client() :
|
|||||||
d->maxPipelineDepth = 5;
|
d->maxPipelineDepth = 5;
|
||||||
setUserAgent("SimGear-" SG_STRINGIZE(SIMGEAR_VERSION));
|
setUserAgent("SimGear-" SG_STRINGIZE(SIMGEAR_VERSION));
|
||||||
|
|
||||||
|
d->tlsCertificatePath = SGPath::fromEnv("SIMGEAR_TLS_CERT_PATH");
|
||||||
|
|
||||||
static bool didInitCurlGlobal = false;
|
static bool didInitCurlGlobal = false;
|
||||||
if (!didInitCurlGlobal) {
|
if (!didInitCurlGlobal) {
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
@@ -275,6 +279,11 @@ void Client::makeRequest(const Request_ptr& r)
|
|||||||
|
|
||||||
curl_easy_setopt(curlRequest, CURLOPT_FOLLOWLOCATION, 1);
|
curl_easy_setopt(curlRequest, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
|
||||||
|
if (!d->tlsCertificatePath.isNull()) {
|
||||||
|
const auto utf8 = d->tlsCertificatePath.utf8Str();
|
||||||
|
curl_easy_setopt(curlRequest, CURLOPT_CAINFO, utf8.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
if (!d->proxy.empty()) {
|
if (!d->proxy.empty()) {
|
||||||
curl_easy_setopt(curlRequest, CURLOPT_PROXY, d->proxy.c_str());
|
curl_easy_setopt(curlRequest, CURLOPT_PROXY, d->proxy.c_str());
|
||||||
curl_easy_setopt(curlRequest, CURLOPT_PROXYPORT, d->proxyPort);
|
curl_easy_setopt(curlRequest, CURLOPT_PROXYPORT, d->proxyPort);
|
||||||
|
|||||||
Reference in New Issue
Block a user