diff options
author | Holger Weiss <hweiss@users.sourceforge.net> | 2008-09-02 11:26:31 (GMT) |
---|---|---|
committer | Holger Weiss <hweiss@users.sourceforge.net> | 2008-09-02 11:26:31 (GMT) |
commit | 8430be0b4b1fe55e15e43bd4980006a412bca77c (patch) | |
tree | 2f879aa01ce85599a377a30717a3134587b58ceb /plugins | |
parent | a24c8f001fade8b136cb03781951d474b5e4456d (diff) | |
download | monitoring-plugins-8430be0b4b1fe55e15e43bd4980006a412bca77c.tar.gz |
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).
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2053 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_http.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c index 718fb84..69ed2fa 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -789,8 +789,18 @@ check_http (void) | |||
789 | asprintf (&buf, "%sConnection: close\r\n", buf); | 789 | asprintf (&buf, "%sConnection: close\r\n", buf); |
790 | 790 | ||
791 | /* optionally send the host header info */ | 791 | /* optionally send the host header info */ |
792 | if (host_name) | 792 | if (host_name) { |
793 | asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | 793 | /* |
794 | * Specify the port only if we're using a non-default port (see RFC 2616, | ||
795 | * 14.23). Some server applications/configurations cause trouble if the | ||
796 | * (default) port is explicitly specified in the "Host:" header line. | ||
797 | */ | ||
798 | if ((use_ssl == FALSE && server_port == HTTP_PORT) || | ||
799 | (use_ssl == TRUE && server_port == HTTPS_PORT)) | ||
800 | asprintf (&buf, "%sHost: %s\r\n", buf, host_name); | ||
801 | else | ||
802 | asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
803 | } | ||
794 | 804 | ||
795 | /* optionally send any other header tag */ | 805 | /* optionally send any other header tag */ |
796 | if (http_opt_headers_count) { | 806 | if (http_opt_headers_count) { |