add support for virtual servers
This commit is contained in:
parent
5182895704
commit
ae251d3e02
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -3,6 +3,8 @@ nagios-plugins (1.4.12-3) UNRELEASED; urgency=low
|
||||||
* rename 40_check_http_status_line.patch to 40_check_http_status_line.dpatch
|
* rename 40_check_http_status_line.patch to 40_check_http_status_line.dpatch
|
||||||
and make it able to apply
|
and make it able to apply
|
||||||
* add 40_check_http_status_line.dpatch to 00list to really fix #486932
|
* add 40_check_http_status_line.dpatch to 00list to really fix #486932
|
||||||
|
* add 41_check_http_fix_http_header.dpatch to support virtual servers
|
||||||
|
(Closes: #494835)
|
||||||
|
|
||||||
-- Jan Wagner <waja@cyconet.org> Fri, 04 Jul 2008 17:04:02 +0200
|
-- Jan Wagner <waja@cyconet.org> Fri, 04 Jul 2008 17:04:02 +0200
|
||||||
|
|
||||||
|
|
33
debian/patches/41_check_http_fix_http_header.dpatch
vendored
Executable file
33
debian/patches/41_check_http_fix_http_header.dpatch
vendored
Executable file
|
@ -0,0 +1,33 @@
|
||||||
|
#! /bin/sh /usr/share/dpatch/dpatch-run
|
||||||
|
## 41_check_http_fix_http_header.dpatch by Jan Wagner <waja@cyconet.org>, taken
|
||||||
|
## from upstream svn
|
||||||
|
##
|
||||||
|
## DP: Re-structure the HTTP 1.1 headers to prevent 301s on servers with virtual hosts
|
||||||
|
|
||||||
|
@DPATCH@
|
||||||
|
diff -urNad nagios-plugins-1.4.12~/plugins/check_http.c nagios-plugins-1.4.12/plugins/check_http.c
|
||||||
|
--- nagios-plugins-1.4.12~/plugins/check_http.c 2008-08-23 15:41:49.000000000 +0200
|
||||||
|
+++ nagios-plugins-1.4.12/plugins/check_http.c 2008-08-23 15:50:14.000000000 +0200
|
||||||
|
@@ -749,15 +749,17 @@
|
||||||
|
}
|
||||||
|
#endif /* HAVE_SSL */
|
||||||
|
|
||||||
|
- asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent);
|
||||||
|
+ /* 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);
|
||||||
|
|
||||||
|
/* 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++) {
|
Loading…
Reference in a new issue