SF.net SVN: nagiosplug:[2147] nagiosplug/trunk

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 2147
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2147&view=rev
Author:   dermoth
Date:     2009-02-05 05:50:24 +0000 (Thu, 05 Feb 2009)

Log Message:
-----------
check_http --onredirect=sticky follows using the same IP address (sf.net #2550208).

From: Thomas Guyot-Sionnest <[email protected]>

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/plugins/check_http.c

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2009-02-03 10:15:21 UTC (rev 2146)
+++ nagiosplug/trunk/NEWS	2009-02-05 05:50:24 UTC (rev 2147)
@@ -20,6 +20,7 @@
 	Re-bundled libtap as a built-in library (--enable-libtap): detects system library as pre-1.4.13 and does not install the built-in library anymore
 	Fixed check_mrtg returning UNKNOWN instead of OK (bug #2378068)
 	Fixed check_http behaviour: all check are now performed as long as a valid response is returned (sf.net #1460312)
+	check_http --onredirect=sticky follows using the same IP address (sf.net #2550208).
 
 1.4.13 25th Sept 2008
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)

Modified: nagiosplug/trunk/plugins/check_http.c
===================================================================
--- nagiosplug/trunk/plugins/check_http.c	2009-02-03 10:15:21 UTC (rev 2146)
+++ nagiosplug/trunk/plugins/check_http.c	2009-02-05 05:50:24 UTC (rev 2147)
@@ -106,6 +106,7 @@
 char **http_opt_headers;
 int http_opt_headers_count = 0;
 int onredirect = STATE_OK;
+int followsticky = 0;
 int use_ssl = FALSE;
 int verbose = FALSE;
 int sd;
@@ -299,8 +300,10 @@
         server_port = HTTPS_PORT;
       break;
     case 'f': /* onredirect */
+      if (!strcmp (optarg, "sticky"))
+        onredirect = STATE_DEPENDENT, followsticky = 1;
       if (!strcmp (optarg, "follow"))
-        onredirect = STATE_DEPENDENT;
+        onredirect = STATE_DEPENDENT, followsticky = 0;
       if (!strcmp (optarg, "unknown"))
         onredirect = STATE_UNKNOWN;
       if (!strcmp (optarg, "ok"))
@@ -1200,8 +1203,10 @@
   free (host_name);
   host_name = strdup (addr);
 
-  free (server_address);
-  server_address = strdup (addr);
+  if (followsticky == 0) {
+    free (server_address);
+    server_address = strdup (addr);
+  }
 
   free (server_url);
   server_url = url;
@@ -1338,8 +1343,9 @@
   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", _("How to handle redirected pages"));
+  printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky>");
+  printf ("    %s\n", _("How to handle redirected pages. sticky is like follow but stick to the"));
+  printf ("    %s\n", _("specified IP address"));
   printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
   printf ("    %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)"));
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.