Skip to content

Commit 5746701

Browse files
authored
Merge pull request #15 from FAIRDataPipeline/ryanjfield-dev
Ryanjfield dev
2 parents 65741f4 + b03d1fd commit 5746701

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/registry/api.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ static size_t write_file_(void *ptr, size_t size, size_t nmemb, FILE *stream) {
1313

1414
std::string url_encode(std::string url) {
1515
CURL *curl_ = curl_easy_init();
16+
curl_easy_setopt(curl_, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
1617
return curl_easy_escape(curl_, url.c_str(), 0);
1718
}
1819

1920
CURL *API::setup_json_session_(std::string &addr_path, std::string *response,
2021
long &http_code, std::string token) {
2122
CURL *curl_ = curl_easy_init();
23+
curl_easy_setopt(curl_, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
2224

2325

2426
if (!token.empty()) {
@@ -53,6 +55,7 @@ void API::download_file(const ghc::filesystem::path &url,
5355

5456
APILogger->debug("API: Downloading file '{0}' -> '{1}'", url.string(),
5557
out_path.string());
58+
curl_easy_setopt(curl_, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
5659
curl_easy_setopt(curl_, CURLOPT_URL, url.c_str());
5760
curl_easy_setopt(curl_, CURLOPT_WRITEFUNCTION, write_file_);
5861
curl_easy_setopt(curl_, CURLOPT_WRITEDATA, file_);
@@ -219,7 +222,7 @@ Json::Value API::post_patch_request(std::string addr_path, Json::Value &post_dat
219222
headers = curl_slist_append(
220223
headers, (std::string("Authorization: token ") + token).c_str());
221224
}
222-
225+
curl_easy_setopt(curl_, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
223226
curl_easy_setopt(curl_, CURLOPT_URL, url_path_.c_str());
224227
curl_easy_setopt(curl_, CURLOPT_HTTPHEADER, headers);
225228
if (PATCH) {

0 commit comments

Comments
 (0)