Forráskód Böngészése

Fix regression in 1.4.10 where following redirects to relative URLs on
virtual hosts failed if both "-H" and "-I" were specified (noted by
Rodrigo A. G. Schichaschwili on nagiosplug-devel@)


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1804 f882894a-f735-0410-b71e-b25c423dba1c

Holger Weiss 18 éve
szülő
commit
604da49392
2 módosított fájl, 8 hozzáadás és 4 törlés
  1. 4 0
      NEWS
  2. 4 4
      plugins/check_http.c

+ 4 - 0
NEWS

@@ -1,5 +1,9 @@
 This file documents the major additions and syntax changes between releases.
 This file documents the major additions and syntax changes between releases.
 
 
+1.4.11 or 1.5 ??
+	Fix check_http regression in 1.4.10 where following redirects to
+	  relative URLs on virtual hosts failed if both "-H" and "-I" were used
+
 1.4.10 28th September 2007
 1.4.10 28th September 2007
 	Fix check_http buffer overflow vulnerability when following HTTP redirects
 	Fix check_http buffer overflow vulnerability when following HTTP redirects
 	check_http now explicitly asks HTTP/1.1 servers to close the connection
 	check_http now explicitly asks HTTP/1.1 servers to close the connection

+ 4 - 4
plugins/check_http.c

@@ -151,7 +151,7 @@ main (int argc, char **argv)
 
 
   if (display_html == TRUE)
   if (display_html == TRUE)
     printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">", 
     printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">", 
-      use_ssl ? "https" : "http", server_address,
+      use_ssl ? "https" : "http", host_name ? host_name : server_address,
       server_port, server_url);
       server_port, server_url);
 
 
   /* initialize alarm signal handling, set socket timeout, start timer */
   /* initialize alarm signal handling, set socket timeout, start timer */
@@ -1155,7 +1155,7 @@ redir (char *pos, char *status_line)
       }
       }
       i = server_port;
       i = server_port;
       strcpy (type, server_type);
       strcpy (type, server_type);
-      strcpy (addr, server_address);
+      strcpy (addr, host_name ? host_name : server_address);
     }           
     }           
 
 
     else {
     else {
@@ -1204,8 +1204,8 @@ redir (char *pos, char *status_line)
          display_html ? "</A>" : "");
          display_html ? "</A>" : "");
 
 
   if (verbose)
   if (verbose)
-    printf (_("Redirection to %s://%s:%d%s\n"), server_type, 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);
 
 
   check_http ();
   check_http ();
 }
 }