ArdourHttp, export API to set CA paths
Ideally all https requests would pass via ArdourCurl, instead of custom libcurl usage, but that will require some major refactoring
This commit is contained in:
parent
5476a20fc4
commit
3caa58ba78
|
@ -52,6 +52,20 @@ using namespace ArdourCurl;
|
||||||
const char* HttpGet::ca_path = NULL;
|
const char* HttpGet::ca_path = NULL;
|
||||||
const char* HttpGet::ca_info = NULL;
|
const char* HttpGet::ca_info = NULL;
|
||||||
|
|
||||||
|
void
|
||||||
|
HttpGet::ca_setopt (CURL* c)
|
||||||
|
{
|
||||||
|
if (ca_info) {
|
||||||
|
curl_easy_setopt (c, CURLOPT_CAINFO, ca_info);
|
||||||
|
}
|
||||||
|
if (ca_path) {
|
||||||
|
curl_easy_setopt (c, CURLOPT_CAPATH, ca_path);
|
||||||
|
}
|
||||||
|
if (ca_info || ca_path) {
|
||||||
|
curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HttpGet::setup_certificate_paths ()
|
HttpGet::setup_certificate_paths ()
|
||||||
{
|
{
|
||||||
|
@ -162,15 +176,8 @@ HttpGet::HttpGet (bool p, bool ssl)
|
||||||
// cc= curl_easy_setopt (_curl, CURLOPT_FOLLOWLOCATION, 1); CCERR ("CURLOPT_FOLLOWLOCATION");
|
// cc= curl_easy_setopt (_curl, CURLOPT_FOLLOWLOCATION, 1); CCERR ("CURLOPT_FOLLOWLOCATION");
|
||||||
|
|
||||||
// by default use curl's default.
|
// by default use curl's default.
|
||||||
if (ssl && ca_info) {
|
if (ssl) {
|
||||||
curl_easy_setopt (_curl, CURLOPT_CAINFO, ca_info);
|
ca_setopt (_curl);
|
||||||
}
|
|
||||||
if (ssl && ca_path) {
|
|
||||||
curl_easy_setopt (_curl, CURLOPT_CAPATH, ca_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ssl && (ca_info || ca_path)) {
|
|
||||||
curl_easy_setopt (_curl, CURLOPT_SSL_VERIFYPEER, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,8 @@ class HttpGet {
|
||||||
// called from fixup_bundle_environment
|
// called from fixup_bundle_environment
|
||||||
static void setup_certificate_paths ();
|
static void setup_certificate_paths ();
|
||||||
|
|
||||||
|
static void ca_setopt (CURL*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CURL* _curl;
|
CURL* _curl;
|
||||||
bool persist;
|
bool persist;
|
||||||
|
@ -94,8 +96,6 @@ class HttpGet {
|
||||||
char* http_get (const char* url, int* status, bool with_error_logging);
|
char* http_get (const char* url, int* status, bool with_error_logging);
|
||||||
std::string http_get (const std::string& url, bool with_error_logging);
|
std::string http_get (const std::string& url, bool with_error_logging);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif /* __gtk_ardour_http_h__ */
|
#endif /* __gtk_ardour_http_h__ */
|
||||||
|
|
Loading…
Reference in New Issue