From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/429681-check_http.patch | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 web/attachments/429681-check_http.patch (limited to 'web/attachments/429681-check_http.patch') diff --git a/web/attachments/429681-check_http.patch b/web/attachments/429681-check_http.patch new file mode 100644 index 0000000..ae9d48a --- /dev/null +++ b/web/attachments/429681-check_http.patch @@ -0,0 +1,80 @@ +--- nagios-plugins-1.4.15/plugins/check_http.c 2011-11-28 16:35:25.000000000 +0000 ++++ nagios-plugins-1.4.15.new/plugins/check_http.c 2011-11-28 13:26:56.000000000 +0000 +@@ -90,10 +90,12 @@ + + int specify_port = FALSE; + int server_port = HTTP_PORT; ++int virtual_port = 0; + char server_port_text[6] = ""; + char server_type[6] = "http"; + char *server_address; + char *host_name; ++int host_name_length; + char *server_url; + char *user_agent; + int server_url_length; +@@ -334,11 +336,25 @@ + case 'H': /* Host Name (virtual host) */ + host_name = strdup (optarg); + if (host_name[0] == '[') { +- if ((p = strstr (host_name, "]:")) != NULL) /* [IPv6]:port */ +- server_port = atoi (p + 2); ++ if ((p = strstr (host_name, "]:")) != NULL) { /* [IPv6]:port */ ++ virtual_port = atoi (p + 2); ++ /* cut off the port */ ++ host_name_length = strlen (host_name) - strlen (p) - 1; ++ free (host_name); ++ host_name = strndup (optarg, host_name_length); ++ if (specify_port == FALSE) ++ server_port = virtual_port; ++ } + } else if ((p = strchr (host_name, ':')) != NULL +- && strchr (++p, ':') == NULL) /* IPv4:port or host:port */ +- server_port = atoi (p); ++ && strchr (++p, ':') == NULL) { /* IPv4:port or host:port */ ++ virtual_port = atoi (p); ++ /* cut off the port */ ++ host_name_length = strlen (host_name) - strlen (p) - 1; ++ free (host_name); ++ host_name = strndup (optarg, host_name_length); ++ if (specify_port == FALSE) ++ server_port = virtual_port; ++ } + break; + case 'I': /* Server IP-address */ + server_address = strdup (optarg); +@@ -484,6 +500,9 @@ + if (http_method == NULL) + http_method = strdup ("GET"); + ++ if (virtual_port == 0) ++ virtual_port = server_port; ++ + return TRUE; + } + +@@ -829,11 +848,11 @@ + * 14.23). Some server applications/configurations cause trouble if the + * (default) port is explicitly specified in the "Host:" header line. + */ +- if ((use_ssl == FALSE && server_port == HTTP_PORT) || +- (use_ssl == TRUE && server_port == HTTPS_PORT)) ++ if ((use_ssl == FALSE && virtual_port == HTTP_PORT) || ++ (use_ssl == TRUE && virtual_port == HTTPS_PORT)) + asprintf (&buf, "%sHost: %s\r\n", buf, host_name); + else +- asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); ++ asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, virtual_port); + } + + /* optionally send any other header tag */ +@@ -1255,6 +1274,9 @@ + MAX_PORT, server_type, server_address, server_port, server_url, + display_html ? "" : ""); + ++ /* reset virtual port */ ++ virtual_port = server_port; ++ + if (verbose) + printf (_("Redirection to %s://%s:%d%s\n"), server_type, + host_name ? host_name : server_address, server_port, server_url); -- cgit v1.2.3-74-g34f1