From 6969f5719268dec6459d9107e11a711dab3a18dd Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 11 Sep 2025 11:24:16 +0200 Subject: check_curl: improve option handling a bit --- plugins/check_curl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/check_curl.c') diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 0784fb8b..485a8744 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -1139,7 +1139,7 @@ mp_state_enum check_http(const check_curl_config config, check_curl_working_stat } /* make sure the status line matches the response we are looking for */ - if (!expected_statuscode(global_state.status_line.first_line, config.server_expect)) { + if (!expected_statuscode(global_state.status_line.first_line, config.server_expect.string)) { if (workingState.serverPort == HTTP_PORT) { snprintf(msg, DEFAULT_BUFFER_SIZE, _("Invalid HTTP response received from host: %s\n"), global_state.status_line.first_line); @@ -1153,7 +1153,7 @@ mp_state_enum check_http(const check_curl_config config, check_curl_working_stat } mp_state_enum result = STATE_OK; - if (config.server_expect_yn) { + if (config.server_expect.is_present) { snprintf(msg, DEFAULT_BUFFER_SIZE, _("Status line output matched \"%s\" - "), config.server_expect); if (verbose) { @@ -1893,9 +1893,9 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) { result.config.string_expect[MAX_INPUT_BUFFER - 1] = 0; break; case 'e': /* string or substring */ - strncpy(result.config.server_expect, optarg, MAX_INPUT_BUFFER - 1); - result.config.server_expect[MAX_INPUT_BUFFER - 1] = 0; - result.config.server_expect_yn = true; + strncpy(result.config.server_expect.string, optarg, MAX_INPUT_BUFFER - 1); + result.config.server_expect.string[MAX_INPUT_BUFFER - 1] = 0; + result.config.server_expect.is_present = true; break; case 'T': /* Content-type */ result.config.http_content_type = strdup(optarg); -- cgit v1.2.3-74-g34f1