Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

httpclient: Always set path to CA certs #1294

Merged
merged 1 commit into from
Aug 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libaktualizr/http/httpclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ HttpClient::HttpClient(const std::vector<std::string>* extra_headers) {
curlEasySetoptWrapper(curl, CURLOPT_NOSIGNAL, 1L);
curlEasySetoptWrapper(curl, CURLOPT_TIMEOUT, 60L);
curlEasySetoptWrapper(curl, CURLOPT_CONNECTTIMEOUT, 60L);
curlEasySetoptWrapper(curl, CURLOPT_CAPATH, Utils::getCaPath());

// let curl use our write function
curlEasySetoptWrapper(curl, CURLOPT_WRITEFUNCTION, writeString);
Expand Down
6 changes: 6 additions & 0 deletions src/libaktualizr/utilities/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,12 @@ const char *Utils::getUserAgent() {

std::string Utils::user_agent_;

void Utils::setCaPath(boost::filesystem::path path) { ca_path_ = std::move(path); }

const char *Utils::getCaPath() { return ca_path_.c_str(); }

boost::filesystem::path Utils::ca_path_{"/etc/ssl/certs"};

TemporaryFile::TemporaryFile(const std::string &hint)
: tmp_name_(SafeTempRoot::Get() / boost::filesystem::unique_path(std::string("%%%%-%%%%-").append(hint))) {}

Expand Down
4 changes: 4 additions & 0 deletions src/libaktualizr/utilities/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ struct Utils {
static void setUserAgent(std::string user_agent);
static const char *getUserAgent();

static void setCaPath(boost::filesystem::path path);
static const char *getCaPath();

private:
static std::string storage_root_path_;
static std::string user_agent_;
static boost::filesystem::path ca_path_;
};

/**
Expand Down