#26 Enable option to use custom certs

master 1.00
JuanJakobo 2022-09-02 09:46:17 +02:00
parent bc26040897
commit fca498570e
2 changed files with 8 additions and 1 deletions

View File

@ -231,6 +231,11 @@ string WebDAV::propfind(const string &pathUrl)
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PROPFIND");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Util::writeCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
if (iv_access(CACERT_PATH.c_str(), R_OK) == 0)
curl_easy_setopt(curl, CURLOPT_CAINFO, CACERT_PATH.c_str());
//TODO add sorter here
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?> \
<d:propfind xmlns:d=\"DAV:\"><d:prop xmlns:oc=\"http://owncloud.org/ns\"> \
<d:getlastmodified/> \
@ -310,6 +315,8 @@ bool WebDAV::get(WebDAVItem &item)
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, Util::progress_callback);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
if (iv_access(CACERT_PATH.c_str(), R_OK) == 0)
curl_easy_setopt(curl, CURLOPT_CAINFO, CACERT_PATH.c_str());
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
iv_fclose(fp);

View File

@ -17,8 +17,8 @@
const std::string NEXTCLOUD_ROOT_PATH = "/remote.php/dav/files/";
const std::string NEXTCLOUD_START_PATH = "/remote.php/";
const std::string CACERT_PATH = "/mnt/ext1/applications/cacert.pem";
const std::string NEXTCLOUD_PATH = "/mnt/ext1/system/config/nextcloud";
const std::string CACERT_PATH = NEXTCLOUD_PATH + "/customCert.pem";
class WebDAV
{