summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-09-13 12:28:49 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-09-13 12:28:49 +0200
commit9afb5e2a6964aad149ca3ef0c175fcd510220505 (patch)
tree01135961c38e90301164445159a87d172629e7b9 /plugins
parent44b2a25a6b9fb0791ec7150100a4d51e5f129611 (diff)
downloadmonitoring-plugins-9afb5e2a6964aad149ca3ef0c175fcd510220505.tar.gz
check_curl: remove display-html option
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_curl.c35
-rw-r--r--plugins/check_curl.d/check_curl_helpers.c1
-rw-r--r--plugins/check_curl.d/config.h1
3 files changed, 11 insertions, 26 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 722666dd..17fb5564 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -139,16 +139,6 @@ int main(int argc, char **argv) {
139 139
140 const check_curl_config config = tmp_config.config; 140 const check_curl_config config = tmp_config.config;
141 141
142 if (config.display_html) {
143 printf("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
144 config.initial_config.use_ssl ? "https" : "http",
145 config.initial_config.host_name ? config.initial_config.host_name
146 : config.initial_config.server_address,
147 config.initial_config.virtualPort ? config.initial_config.virtualPort
148 : config.initial_config.serverPort,
149 config.initial_config.server_url);
150 }
151
152 check_curl_working_state working_state = config.initial_config; 142 check_curl_working_state working_state = config.initial_config;
153 143
154 mp_check overall = mp_check_init(); 144 mp_check overall = mp_check_init();
@@ -672,8 +662,8 @@ redir_wrapper redir(curlhelp_write_curlbuf *header_buf, const check_curl_config
672 } 662 }
673 663
674 if (++redir_depth > config.max_depth) { 664 if (++redir_depth > config.max_depth) {
675 die(STATE_WARNING, _("HTTP WARNING - maximum redirection depth %d exceeded - %s%s\n"), 665 die(STATE_WARNING, _("HTTP WARNING - maximum redirection depth %d exceeded - %s\n"),
676 config.max_depth, location, (config.display_html ? "</A>" : "")); 666 config.max_depth, location);
677 } 667 }
678 668
679 UriParserStateA state; 669 UriParserStateA state;
@@ -681,8 +671,8 @@ redir_wrapper redir(curlhelp_write_curlbuf *header_buf, const check_curl_config
681 state.uri = &uri; 671 state.uri = &uri;
682 if (uriParseUriA(&state, location) != URI_SUCCESS) { 672 if (uriParseUriA(&state, location) != URI_SUCCESS) {
683 if (state.errorCode == URI_ERROR_SYNTAX) { 673 if (state.errorCode == URI_ERROR_SYNTAX) {
684 die(STATE_UNKNOWN, _("HTTP UNKNOWN - Could not parse redirect location '%s'%s\n"), 674 die(STATE_UNKNOWN, _("HTTP UNKNOWN - Could not parse redirect location '%s'\n"),
685 location, (config.display_html ? "</A>" : "")); 675 location);
686 } else if (state.errorCode == URI_ERROR_MALLOC) { 676 } else if (state.errorCode == URI_ERROR_MALLOC) {
687 die(STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n")); 677 die(STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n"));
688 } 678 }
@@ -735,8 +725,8 @@ redir_wrapper redir(curlhelp_write_curlbuf *header_buf, const check_curl_config
735 } 725 }
736 } 726 }
737 if (new_port > MAX_PORT) { 727 if (new_port > MAX_PORT) {
738 die(STATE_UNKNOWN, _("HTTP UNKNOWN - Redirection to port above %d - %s%s\n"), MAX_PORT, 728 die(STATE_UNKNOWN, _("HTTP UNKNOWN - Redirection to port above %d - %s\n"), MAX_PORT,
739 location, config.display_html ? "</A>" : ""); 729 location);
740 } 730 }
741 731
742 /* by RFC 7231 relative URLs in Location should be taken relative to 732 /* by RFC 7231 relative URLs in Location should be taken relative to
@@ -772,9 +762,8 @@ redir_wrapper redir(curlhelp_write_curlbuf *header_buf, const check_curl_config
772 !strncmp(working_state.host_name, new_host, MAX_IPV4_HOSTLENGTH)) && 762 !strncmp(working_state.host_name, new_host, MAX_IPV4_HOSTLENGTH)) &&
773 !strcmp(working_state.server_url, new_url)) { 763 !strcmp(working_state.server_url, new_url)) {
774 die(STATE_CRITICAL, 764 die(STATE_CRITICAL,
775 _("HTTP CRITICAL - redirection creates an infinite loop - %s://%s:%d%s%s\n"), 765 _("HTTP CRITICAL - redirection creates an infinite loop - %s://%s:%d%s\n"),
776 working_state.use_ssl ? "https" : "http", new_host, new_port, new_url, 766 working_state.use_ssl ? "https" : "http", new_host, new_port, new_url);
777 (config.display_html ? "</A>" : ""));
778 } 767 }
779 768
780 /* set new values for redirected request */ 769 /* set new values for redirected request */
@@ -1037,10 +1026,8 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) {
1037 .http_opt_headers[result.config.curl_config.http_opt_headers_count - 1] = optarg; 1026 .http_opt_headers[result.config.curl_config.http_opt_headers_count - 1] = optarg;
1038 break; 1027 break;
1039 case 'L': /* show html link */ 1028 case 'L': /* show html link */
1040 result.config.display_html = true;
1041 break;
1042 case 'n': /* do not show html link */ 1029 case 'n': /* do not show html link */
1043 result.config.display_html = false; 1030 // HTML link related options are deprecated
1044 break; 1031 break;
1045 case 'C': /* Check SSL cert validity */ 1032 case 'C': /* Check SSL cert validity */
1046#ifndef LIBCURL_FEATURE_SSL 1033#ifndef LIBCURL_FEATURE_SSL
@@ -1566,8 +1553,8 @@ void print_help(void) {
1566 printf(" %s\n", _("Print additional performance data")); 1553 printf(" %s\n", _("Print additional performance data"));
1567 printf(" %s\n", "-B, --show-body"); 1554 printf(" %s\n", "-B, --show-body");
1568 printf(" %s\n", _("Print body content below status line")); 1555 printf(" %s\n", _("Print body content below status line"));
1569 printf(" %s\n", "-L, --link"); 1556 // printf(" %s\n", "-L, --link");
1570 printf(" %s\n", _("Wrap output in HTML link (obsoleted by urlize)")); 1557 // printf(" %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
1571 printf(" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport|curl>"); 1558 printf(" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport|curl>");
1572 printf(" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the")); 1559 printf(" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the"));
1573 printf(" %s\n", _("specified IP address. stickyport also ensures port stays the same.")); 1560 printf(" %s\n", _("specified IP address. stickyport also ensures port stays the same."));
diff --git a/plugins/check_curl.d/check_curl_helpers.c b/plugins/check_curl.d/check_curl_helpers.c
index 49949ccb..f0a4d265 100644
--- a/plugins/check_curl.d/check_curl_helpers.c
+++ b/plugins/check_curl.d/check_curl_helpers.c
@@ -630,7 +630,6 @@ check_curl_config check_curl_config_init() {
630 630
631 .show_extended_perfdata = false, 631 .show_extended_perfdata = false,
632 .show_body = false, 632 .show_body = false,
633 .display_html = false,
634 }; 633 };
635 634
636 snprintf(tmp.curl_config.user_agent, DEFAULT_BUFFER_SIZE, "%s/v%s (monitoring-plugins %s, %s)", 635 snprintf(tmp.curl_config.user_agent, DEFAULT_BUFFER_SIZE, "%s/v%s (monitoring-plugins %s, %s)",
diff --git a/plugins/check_curl.d/config.h b/plugins/check_curl.d/config.h
index 32399b8a..6100af3e 100644
--- a/plugins/check_curl.d/config.h
+++ b/plugins/check_curl.d/config.h
@@ -108,7 +108,6 @@ typedef struct {
108 108
109 bool show_extended_perfdata; 109 bool show_extended_perfdata;
110 bool show_body; 110 bool show_body;
111 bool display_html;
112} check_curl_config; 111} check_curl_config;
113 112
114check_curl_config check_curl_config_init(); 113check_curl_config check_curl_config_init();