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.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
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.