diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-09-01 14:04:04 (GMT) |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-09-01 14:04:04 (GMT) |
commit | e9f976fbf3af9c5a923fd56f97e71bcf03d05716 (patch) | |
tree | 9fbc0fe4c8e6404721c00d30734fe27d5f63d04b | |
parent | e8c7d1b3d13b6a40004672ffeab0486f7fb79b71 (diff) | |
download | monitoring-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
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | plugins/check_http.c | 12 |
3 files changed, 5 insertions, 9 deletions
@@ -9,7 +9,6 @@ This file documents the major additions and syntax changes between releases. | |||
9 | check_procs now captures stderr in external command and adds to plugin output | 9 | check_procs now captures stderr in external command and adds to plugin output |
10 | check_snmp now only prints perfdata for non numeric values (#1867716) | 10 | check_snmp now only prints perfdata for non numeric values (#1867716) |
11 | check_icmp now supports packet size modification | 11 | check_icmp now supports packet size modification |
12 | check_http now sends the Host header first to fix 301s on servers with vitrual hosts (Michael Harris). | ||
13 | check_http -e now accepts a comma-delimited list of expected status codes | 12 | check_http -e now accepts a comma-delimited list of expected status codes |
14 | libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap | 13 | libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap |
15 | 14 | ||
@@ -236,5 +236,4 @@ Jan Wagner | |||
236 | Christian Schneemann | 236 | Christian Schneemann |
237 | Rob Windsor | 237 | Rob Windsor |
238 | Hilko Bengen | 238 | Hilko Bengen |
239 | Michael Harris | ||
240 | Sven Nierlein | 239 | Sven Nierlein |
diff --git a/plugins/check_http.c b/plugins/check_http.c index 4a3d692..718fb84 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -783,17 +783,15 @@ check_http (void) | |||
783 | } | 783 | } |
784 | #endif /* HAVE_SSL */ | 784 | #endif /* HAVE_SSL */ |
785 | 785 | ||
786 | /* If a hostname is provided, use HTTP/1.1 and send the hostname before the | 786 | asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent); |
787 | * Useragent. This fixes an issue with getting 301 responses from servers | ||
788 | * with virtual hosts */ | ||
789 | if (host_name) | ||
790 | asprintf (&buf, "%s %s HTTP/1.1\r\nHost: %s\r\n%s\r\n", http_method, server_url, host_name, user_agent); | ||
791 | else | ||
792 | asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent); | ||
793 | 787 | ||
794 | /* tell HTTP/1.1 servers not to keep the connection alive */ | 788 | /* tell HTTP/1.1 servers not to keep the connection alive */ |
795 | asprintf (&buf, "%sConnection: close\r\n", buf); | 789 | asprintf (&buf, "%sConnection: close\r\n", buf); |
796 | 790 | ||
791 | /* optionally send the host header info */ | ||
792 | if (host_name) | ||
793 | asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port); | ||
794 | |||
797 | /* optionally send any other header tag */ | 795 | /* optionally send any other header tag */ |
798 | if (http_opt_headers_count) { | 796 | if (http_opt_headers_count) { |
799 | for (i = 0; i < http_opt_headers_count ; i++) { | 797 | for (i = 0; i < http_opt_headers_count ; i++) { |