[Nagiosplug-devel] [ nagiosplug-Bugs-2550208 ] Patch to check_http redirect behaviour
SourceForge.net
noreply at sourceforge.net
Thu Feb 5 05:31:39 CET 2009
Bugs item #2550208, was opened at 2009-01-30 15:36
Message generated for change (Comment added) made by dermoth
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=2550208&group_id=29880
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General plugin execution
Group: Release (specify)
Status: Open
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Jan Wagner (cyco_dd)
>Assigned to: Thomas Guyot-Sionnest (dermoth)
Summary: Patch to check_http redirect behaviour
Initial Comment:
The following Bugreport we got against our debian package:
If told to follow redirects, check_http follows exactly disregarding
any supplied IP address. Of course this might be what you want.
The included patch adds another option to the -f|--on-redirect switch
which will follow but still connect to the same host. It might be
considered a bug that even if an IP address is NOT given, the same host
will be connected to.
--- check_http.c~ 2008-05-07 11:02:42.000000000 +0100
+++ check_http.c 2008-10-17 09:45:38.000000000 +0100
@@ -110,6 +110,7 @@
char **http_opt_headers;
int http_opt_headers_count = 0;
int onredirect = STATE_OK;
+int follow_same_ip = FALSE;
int use_ssl = FALSE;
int verbose = FALSE;
int sd;
@@ -302,6 +303,11 @@
server_port = HTTPS_PORT;
break;
case 'f': /* onredirect */
+ if (!strcmp (optarg, "follow-same-ip"))
+ {
+ onredirect = STATE_DEPENDENT;
+ follow_same_ip = TRUE;
+ }
if (!strcmp (optarg, "follow"))
onredirect = STATE_DEPENDENT;
if (!strcmp (optarg, "unknown"))
@@ -1151,8 +1158,11 @@
free (host_name);
host_name = strdup (addr);
- free (server_address);
- server_address = strdup (addr);
+ if (!follow_same_ip)
+ {
+ free (server_address);
+ server_address = strdup (addr);
+ }
free (server_url);
if ((url[0] == '/'))
@@ -1169,8 +1179,12 @@
display_html ? "</A>" : "");
if (verbose)
- printf (_("Redirection to %s://%s:%d%s\n"), server_type,
- host_name ? host_name : server_address, server_port, server_url);
+ {
+ printf (_("Redirection to %s://%s:%d%s\n"), server_type,
+ host_name ? host_name : server_address, server_port, server_url);
+ if (!host_name)
+ printf (_("Connecting to %s.\n"), server_address);
+ }
check_http ();
}
@@ -1292,7 +1306,7 @@
printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers"));
printf (" %s\n", "-L, --link");
printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
- printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>");
+ printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|follow-same-ip>");
printf (" %s\n", _("How to handle redirected pages"));
printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)"));
@@ -1346,7 +1360,7 @@
printf (_("Usage:"));
printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname);
printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n");
- printf (" [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n");
+ printf (" [-a auth] [-f <ok | warn | critcal | follow | follow-same-ip>] [-e <expect>]\n");
printf (" [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string]\n");
printf (" [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string]\n");
printf (" [-k string] [-S] [-C <age>] [-T <content-type>]\n");
You can track the bugreport via http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502529
----------------------------------------------------------------------
>Comment By: Thomas Guyot-Sionnest (dermoth)
Date: 2009-02-04 23:31
Message:
Thanks for your report. I just realized my onredirects indeed end up on the
wrong ip :)
You should always attach the patch, otherwise formating is lost and it
can't be applied. It looks like your patch is not totally complete neither.
Don't worry though, I'll rather implement it trough --onredirect=sticky
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=2550208&group_id=29880
More information about the Devel
mailing list