Use PBD::CCurl for Ardour GUI HTTP/S requests

This commit is contained in:
Robin Gareus 2025-05-19 23:38:46 +02:00
parent 4f300b5474
commit 7b6ca334df
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
5 changed files with 23 additions and 99 deletions

View file

@ -18,15 +18,16 @@
#pragma once
#include <curl/curl.h>
#include <string>
#include <map>
#include "pbd/ccurl.h"
namespace ArdourCurl {
class HttpGet {
public:
HttpGet (bool persist = false, bool ssl = true);
HttpGet (bool persist = false);
~HttpGet ();
struct MemStruct {
@ -54,11 +55,11 @@ public:
std::map<std::string, std::string> header () const { return nfo.h; }
char* escape (const char* s, int l) const {
return curl_easy_escape (_curl, s, l);
return curl_easy_escape (_ccurl.curl (), s, l);
}
char* unescape (const char* s, int l, int *o) const {
return curl_easy_unescape (_curl, s, l, o);
return curl_easy_unescape (_ccurl.curl (), s, l, o);
}
/* this is only to be used for data returned by from
@ -69,15 +70,13 @@ public:
std::string error () const;
CURL* curl () const { return _curl; }
// called from fixup_bundle_environment
static void setup_certificate_paths ();
CURL* curl () const { return _ccurl.curl (); }
static void ca_setopt (CURL*);
private:
CURL* _curl;
PBD::CCurl _ccurl;
bool persist;
long int _status;
@ -87,9 +86,6 @@ private:
struct MemStruct mem;
struct HeaderInfo nfo;
static const char* ca_path;
static const char* ca_info;
};
char* http_get (const char* url, int* status, bool with_error_logging);