From 605d59f957bc32e57adc0cd40f449ebe41c782ab Mon Sep 17 00:00:00 2001 From: inqrphl <32687873+inqrphl@users.noreply.github.com> Date: Wed, 17 Jun 2026 23:26:04 +0200 Subject: check_curl fix: populate the dns cache when hostname gets resolved locally (#2280) * check_curl fix: populate the dns cache when hostname gets resolved locally due to a previous refactor, it would populate it when hostname wasnt getting resolved locally hostname_gets_resolved locally now assumes that resolving is local if proxy was unknown. previously was returning 0 instead of true, contradicting what it says fix a memory leak. server_address_clean was being assigned to another strndup result before being freed fix another memory leak, one path to return in hostname_gets_resolved_locally was not freeing up two variables improve logs and comments around hostname_gets_resolved_locally clang-format is applied * check_curl: fix typo in comment --------- Co-authored-by: Ahmet Oeztuerk --- plugins/check_curl.d/check_curl_helpers.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'plugins/check_curl.d/check_curl_helpers.h') diff --git a/plugins/check_curl.d/check_curl_helpers.h b/plugins/check_curl.d/check_curl_helpers.h index 55df9bc1..2f9b0d1c 100644 --- a/plugins/check_curl.d/check_curl_helpers.h +++ b/plugins/check_curl.d/check_curl_helpers.h @@ -127,9 +127,10 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_ int crit_days_till_exp); char *fmt_url(check_curl_working_state workingState); -/* determine_hostname_resolver determines if the host or the proxy resolves the target hostname -returns RESOLVE_LOCALLY if requester resolves the hostname locally, RESOLVE_REMOTELY if proxy -resolves the hostname */ +/* hostname_gets_resolved_locally determines if the host or the proxy resolves the target hostname. +This depends on proxy schema, forced proxy and noproxy hostnames, wildcarded hostnames, IP addresses +and IP CIDRs. Returns true if the host resolves the hostname locally, and false if proxy resolves +the hostname */ bool hostname_gets_resolved_locally(const check_curl_working_state working_state); /* Checks if an IP is inside given CIDR region. Using /protocol_size or not specifying the prefix -- cgit v1.2.3-74-g34f1