Imported Upstream version 2.0
This commit is contained in:
parent
c89ccc3c74
commit
0841b5c7c7
165 changed files with 25440 additions and 4442 deletions
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_http plugin
|
||||
* Monitoring check_http plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2013 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2013 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
const char *progname = "check_http";
|
||||
const char *copyright = "1999-2013";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -57,7 +57,7 @@ enum {
|
|||
|
||||
#ifdef HAVE_SSL
|
||||
int check_cert = FALSE;
|
||||
int ssl_version;
|
||||
int ssl_version = 0;
|
||||
int days_till_exp_warn, days_till_exp_crit;
|
||||
char *randbuff;
|
||||
X509 *server_cert;
|
||||
|
@ -157,7 +157,7 @@ main (int argc, char **argv)
|
|||
/* Set default URL. Must be malloced for subsequent realloc if --onredirect=follow */
|
||||
server_url = strdup(HTTP_URL);
|
||||
server_url_length = strlen(server_url);
|
||||
xasprintf (&user_agent, "User-Agent: check_http/v%s (nagios-plugins %s)",
|
||||
xasprintf (&user_agent, "User-Agent: check_http/v%s (monitoring-plugins %s)",
|
||||
NP_VERSION, VERSION);
|
||||
|
||||
/* Parse extra opts if any */
|
||||
|
@ -257,7 +257,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:nlLS::m:M:N:E", longopts, &option);
|
||||
c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:nlLS::m:M:NE", longopts, &option);
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
||||
|
@ -339,10 +339,10 @@ process_arguments (int argc, char **argv)
|
|||
case 'S': /* use SSL */
|
||||
#ifdef HAVE_SSL
|
||||
enable_ssl:
|
||||
/* ssl_version initialized to 0 as a default. Only set if it's non-zero. This helps when we include multiple
|
||||
parameters, like -S and -C combinations */
|
||||
use_ssl = TRUE;
|
||||
if (optarg == NULL || c != 'S')
|
||||
ssl_version = 0;
|
||||
else {
|
||||
if (c=='S' && optarg != NULL) {
|
||||
ssl_version = atoi(optarg);
|
||||
if (ssl_version < 1 || ssl_version > 3)
|
||||
usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)"));
|
||||
|
@ -1243,6 +1243,7 @@ redir (char *pos, char *status_line)
|
|||
if (addr == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n"));
|
||||
|
||||
memset(addr, 0, MAX_IPV4_HOSTLENGTH);
|
||||
url = malloc (strcspn (pos, "\r\n"));
|
||||
if (url == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n"));
|
||||
|
@ -1333,8 +1334,8 @@ redir (char *pos, char *status_line)
|
|||
max_depth, type, addr, i, url, (display_html ? "</A>" : ""));
|
||||
|
||||
if (server_port==i &&
|
||||
!strcmp(server_address, addr) &&
|
||||
(host_name && !strcmp(host_name, addr)) &&
|
||||
!strncmp(server_address, addr, MAX_IPV4_HOSTLENGTH) &&
|
||||
(host_name && !strncmp(host_name, addr, MAX_IPV4_HOSTLENGTH)) &&
|
||||
!strcmp(server_url, url))
|
||||
die (STATE_WARNING,
|
||||
_("HTTP WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"),
|
||||
|
@ -1343,11 +1344,11 @@ redir (char *pos, char *status_line)
|
|||
strcpy (server_type, type);
|
||||
|
||||
free (host_name);
|
||||
host_name = strdup (addr);
|
||||
host_name = strndup (addr, MAX_IPV4_HOSTLENGTH);
|
||||
|
||||
if (!(followsticky & STICKY_HOST)) {
|
||||
free (server_address);
|
||||
server_address = strdup (addr);
|
||||
server_address = strndup (addr, MAX_IPV4_HOSTLENGTH);
|
||||
}
|
||||
if (!(followsticky & STICKY_PORT)) {
|
||||
server_port = i;
|
||||
|
@ -1366,6 +1367,7 @@ redir (char *pos, char *status_line)
|
|||
printf (_("Redirection to %s://%s:%d%s\n"), server_type,
|
||||
host_name ? host_name : server_address, server_port, server_url);
|
||||
|
||||
free(addr);
|
||||
check_http ();
|
||||
}
|
||||
|
||||
|
@ -1534,7 +1536,7 @@ print_help (void)
|
|||
|
||||
printf (UT_WARN_CRIT);
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue