Compare commits

...

2 Commits

Author SHA1 Message Date
2bdae98c7e Try to also recognize NO_PROXY 2025-01-26 16:46:21 -06:00
76605a4aed No need to override the cert anymore 2025-01-26 16:25:58 -06:00

View File

@ -413,8 +413,6 @@ static int progress_cb(const git_indexer_progress *stats, void *payload) {
return 0;
}
static int transport_certificate_check_cb(git_cert *cert, int valid, const char *host, void *payload) { return 0; }
/**
* clone_or_fetch: clone if needed, else fetch
*/
@ -426,12 +424,29 @@ void CiLogic::clone_or_fetch(const std::filesystem::path &repo_dir,
ensure_git_inited();
// Use proxy settings via env var if they exist
const char* proxy = repo_url.rfind("https", 0) == 0 ? std::getenv("HTTPS_PROXY") : std::getenv("HTTP_PROXY");
bool proxy = false;
git_proxy_options proxy_opts = GIT_PROXY_OPTIONS_INIT;
if (proxy) {
{
const char* tmp_proxy = repo_url.rfind("https", 0) == 0 ? std::getenv("HTTPS_PROXY") : std::getenv("HTTP_PROXY");
if (tmp_proxy) {
const char* no_proxy_env = std::getenv("NO_PROXY");
if (no_proxy_env) {
std::istringstream iss(std::string{no_proxy_env});
std::string entry;
bool found_no_proxy = false;
while (std::getline(iss, entry, ',')) {
if (!entry.empty() && repo_url.contains(entry)) {
found_no_proxy = true;
break;
}
}
proxy = !found_no_proxy;
} else {
proxy = true;
proxy_opts.type = GIT_PROXY_SPECIFIED;
proxy_opts.url = proxy;
proxy_opts.certificate_check = transport_certificate_check_cb;
proxy_opts.url = tmp_proxy;
}
}
}
git_repository* repo = nullptr;