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

hweiss at users.sourceforge.net hweiss at users.sourceforge.net
Tue Sep 2 13:26:32 CEST 2008


Revision: 2053
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2053&view=rev
Author:   hweiss
Date:     2008-09-02 11:26:31 +0000 (Tue, 02 Sep 2008)

Log Message:
-----------
Some HTTP server applications/configurations cause trouble if the port is
explicitly specified in our "Host:" header line.  Therefore, we now specify the
port only if we're using a non-default port (Erik Wasser - 2082501).

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

Modified: nagiosplug/trunk/THANKS.in
===================================================================
--- nagiosplug/trunk/THANKS.in	2008-09-02 03:42:16 UTC (rev 2052)
+++ nagiosplug/trunk/THANKS.in	2008-09-02 11:26:31 UTC (rev 2053)
@@ -237,3 +237,4 @@
 Rob Windsor
 Hilko Bengen
 Sven Nierlein
+Erik Wasser

Modified: nagiosplug/trunk/plugins/check_http.c
===================================================================
--- nagiosplug/trunk/plugins/check_http.c	2008-09-02 03:42:16 UTC (rev 2052)
+++ nagiosplug/trunk/plugins/check_http.c	2008-09-02 11:26:31 UTC (rev 2053)
@@ -789,8 +789,18 @@
   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);
+  if (host_name) {
+    /*
+     * Specify the port only if we're using a non-default port (see RFC 2616,
+     * 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))
+      asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
+    else
+      asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port);
+  }
 
   /* optionally send any other header tag */
   if (http_opt_headers_count) {


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