diff options
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r-- | plugins/check_http.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 34fb4f0..df2a79c 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -52,7 +52,8 @@ enum { | |||
52 | MAX_IPV4_HOSTLENGTH = 255, | 52 | MAX_IPV4_HOSTLENGTH = 255, |
53 | HTTP_PORT = 80, | 53 | HTTP_PORT = 80, |
54 | HTTPS_PORT = 443, | 54 | HTTPS_PORT = 443, |
55 | MAX_PORT = 65535 | 55 | MAX_PORT = 65535, |
56 | DEFAULT_MAX_REDIRS = 15 | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | #ifdef HAVE_SSL | 59 | #ifdef HAVE_SSL |
@@ -125,7 +126,7 @@ int sd; | |||
125 | int min_page_len = 0; | 126 | int min_page_len = 0; |
126 | int max_page_len = 0; | 127 | int max_page_len = 0; |
127 | int redir_depth = 0; | 128 | int redir_depth = 0; |
128 | int max_depth = 15; | 129 | int max_depth = DEFAULT_MAX_REDIRS; |
129 | char *http_method; | 130 | char *http_method; |
130 | char *http_method_proxy; | 131 | char *http_method_proxy; |
131 | char *http_post_data; | 132 | char *http_post_data; |
@@ -203,7 +204,8 @@ process_arguments (int argc, char **argv) | |||
203 | 204 | ||
204 | enum { | 205 | enum { |
205 | INVERT_REGEX = CHAR_MAX + 1, | 206 | INVERT_REGEX = CHAR_MAX + 1, |
206 | SNI_OPTION | 207 | SNI_OPTION, |
208 | MAX_REDIRS_OPTION | ||
207 | }; | 209 | }; |
208 | 210 | ||
209 | int option = 0; | 211 | int option = 0; |
@@ -242,6 +244,7 @@ process_arguments (int argc, char **argv) | |||
242 | {"use-ipv6", no_argument, 0, '6'}, | 244 | {"use-ipv6", no_argument, 0, '6'}, |
243 | {"extended-perfdata", no_argument, 0, 'E'}, | 245 | {"extended-perfdata", no_argument, 0, 'E'}, |
244 | {"show-body", no_argument, 0, 'B'}, | 246 | {"show-body", no_argument, 0, 'B'}, |
247 | {"max-redirs", required_argument, 0, MAX_REDIRS_OPTION}, | ||
245 | {0, 0, 0, 0} | 248 | {0, 0, 0, 0} |
246 | }; | 249 | }; |
247 | 250 | ||
@@ -373,6 +376,13 @@ process_arguments (int argc, char **argv) | |||
373 | case SNI_OPTION: | 376 | case SNI_OPTION: |
374 | use_sni = TRUE; | 377 | use_sni = TRUE; |
375 | break; | 378 | break; |
379 | case MAX_REDIRS_OPTION: | ||
380 | if (!is_intnonneg (optarg)) | ||
381 | usage2 (_("Invalid max_redirs count"), optarg); | ||
382 | else { | ||
383 | max_depth = atoi (optarg); | ||
384 | } | ||
385 | break; | ||
376 | case 'f': /* onredirect */ | 386 | case 'f': /* onredirect */ |
377 | if (!strcmp (optarg, "stickyport")) | 387 | if (!strcmp (optarg, "stickyport")) |
378 | onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST|STICKY_PORT; | 388 | onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST|STICKY_PORT; |
@@ -1657,9 +1667,11 @@ print_help (void) | |||
1657 | printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>"); | 1667 | printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>"); |
1658 | printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the")); | 1668 | printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the")); |
1659 | printf (" %s\n", _("specified IP address. stickyport also ensures port stays the same.")); | 1669 | printf (" %s\n", _("specified IP address. stickyport also ensures port stays the same.")); |
1670 | printf (" %s\n", "--max-redirs=INTEGER"); | ||
1671 | printf (" %s", _("Maximal number of redirects (default: ")); | ||
1672 | printf ("%d)\n", DEFAULT_MAX_REDIRS); | ||
1660 | printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); | 1673 | printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>"); |
1661 | printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)")); | 1674 | printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)")); |
1662 | |||
1663 | printf (UT_WARN_CRIT); | 1675 | printf (UT_WARN_CRIT); |
1664 | 1676 | ||
1665 | printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | 1677 | printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); |