[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2050] nagiosplug/trunk

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Mon Sep 1 16:04:05 CEST 2008


Revision: 2050
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2050&view=rev
Author:   dermoth
Date:     2008-09-01 14:04:04 +0000 (Mon, 01 Sep 2008)

Log Message:
-----------
Revert "Re-structure the HTTP 1.1 headers to prevent 301s on servers with virtual hosts"

This reverts commit 2030

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

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2008-09-01 12:20:32 UTC (rev 2049)
+++ nagiosplug/trunk/NEWS	2008-09-01 14:04:04 UTC (rev 2050)
@@ -9,7 +9,6 @@
 	check_procs now captures stderr in external command and adds to plugin output
 	check_snmp now only prints perfdata for non numeric values (#1867716)
 	check_icmp now supports packet size modification
-	check_http now sends the Host header first to fix 301s on servers with vitrual hosts (Michael Harris).
 	check_http -e now accepts a comma-delimited list of expected status codes
 	libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap
 

Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in	2008-09-01 12:20:32 UTC (rev 2049)
+++ nagiosplug/trunk/THANKS.in	2008-09-01 14:04:04 UTC (rev 2050)
@@ -236,5 +236,4 @@
 Christian Schneemann
 Rob Windsor
 Hilko Bengen
-Michael Harris
 Sven Nierlein

Modified: nagiosplug/trunk/plugins/check_http.c
===================================================================
--- nagiosplug/trunk/plugins/check_http.c	2008-09-01 12:20:32 UTC (rev 2049)
+++ nagiosplug/trunk/plugins/check_http.c	2008-09-01 14:04:04 UTC (rev 2050)
@@ -783,17 +783,15 @@
   }
 #endif /* HAVE_SSL */
 
-  /* If a hostname is provided, use HTTP/1.1 and send the hostname before the 
-  *  Useragent. This fixes an issue with getting 301 responses from servers
-  *  with virtual hosts */
-  if (host_name)
-    asprintf (&buf, "%s %s HTTP/1.1\r\nHost: %s\r\n%s\r\n", http_method, server_url, host_name, user_agent);  
-  else
-    asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent);
+  asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent);
 
   /* tell HTTP/1.1 servers not to keep the connection alive */
   asprintf (&buf, "%sConnection: close\r\n", buf);
 
+  /* optionally send the host header info */
+  if (host_name)
+    asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port);
+
   /* optionally send any other header tag */
   if (http_opt_headers_count) {
     for (i = 0; i < http_opt_headers_count ; i++) {


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




More information about the Commits mailing list