summaryrefslogtreecommitdiffstats
path: root/plugins/check_curl.d
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-09-10 11:08:52 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-09-10 11:08:52 +0200
commitc06ea4e44caee74486e2931154021a0d0e6c8066 (patch)
treef50686dca76350381aa886be47865d51681bc338 /plugins/check_curl.d
parent01f353228424376b25f20d9b105aaf5b3c7a6f65 (diff)
downloadmonitoring-plugins-c06ea4e44caee74486e2931154021a0d0e6c8066.tar.gz
check_curl: pre compile regex for string matching
Diffstat (limited to 'plugins/check_curl.d')
-rw-r--r--plugins/check_curl.d/config.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/check_curl.d/config.h b/plugins/check_curl.d/config.h
index 9de68713..9acd4048 100644
--- a/plugins/check_curl.d/config.h
+++ b/plugins/check_curl.d/config.h
@@ -8,6 +8,7 @@
8#include <string.h> 8#include <string.h>
9#include <sys/socket.h> 9#include <sys/socket.h>
10#include "curl/curl.h" 10#include "curl/curl.h"
11#include "regex.h"
11 12
12enum { 13enum {
13 MAX_RE_SIZE = 1024, 14 MAX_RE_SIZE = 1024,
@@ -87,7 +88,13 @@ typedef struct {
87 char *cookie_jar_file; 88 char *cookie_jar_file;
88 89
89 int maximum_age; 90 int maximum_age;
91
92 // the original regex string from the command line
90 char regexp[MAX_RE_SIZE]; 93 char regexp[MAX_RE_SIZE];
94
95 // the compiled regex for usage later
96 regex_t compiled_regex;
97
91 mp_state_enum state_regex; 98 mp_state_enum state_regex;
92 bool invert_regex; 99 bool invert_regex;
93 bool verify_peer_and_host; 100 bool verify_peer_and_host;
@@ -136,6 +143,7 @@ check_curl_config check_curl_config_init() {
136 143
137 .maximum_age = -1, 144 .maximum_age = -1,
138 .regexp = {}, 145 .regexp = {},
146 .compiled_regex = {},
139 .state_regex = STATE_CRITICAL, 147 .state_regex = STATE_CRITICAL,
140 .invert_regex = false, 148 .invert_regex = false,
141 .verify_peer_and_host = false, 149 .verify_peer_and_host = false,