aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-09-01 14:04:04 +0000
committerGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2008-09-01 14:04:04 +0000
commite9f976fbf3af9c5a923fd56f97e71bcf03d05716 (patch)
tree9fbc0fe4c8e6404721c00d30734fe27d5f63d04b /plugins
parente8c7d1b3d13b6a40004672ffeab0486f7fb79b71 (diff)
downloadmonitoring-plugins-e9f976fbf3af9c5a923fd56f97e71bcf03d05716.tar.gz
Revert "Re-structure the HTTP 1.1 headers to prevent 301s on servers with virtual hosts"
This reverts commit 2030 git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2050 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_http.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 4a3d692b..718fb840 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -783,17 +783,15 @@ check_http (void)
}
#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++) {