aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--THANKS.in1
-rw-r--r--plugins/check_http.c14
2 files changed, 13 insertions, 2 deletions
diff --git a/THANKS.in b/THANKS.in
index 56bc7ee2..a003fa81 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -237,3 +237,4 @@ Christian Schneemann
Rob Windsor
Hilko Bengen
Sven Nierlein
+Erik Wasser
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 718fb840..69ed2fa9 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -789,8 +789,18 @@ check_http (void)
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) {