summaryrefslogtreecommitdiffstats
path: root/plugins/check_http.c
diff options
context:
space:
mode:
authorHolger Weiss <hweiss@users.sourceforge.net>2007-07-21 16:29:01 +0000
committerHolger Weiss <hweiss@users.sourceforge.net>2007-07-21 16:29:01 +0000
commit475ee7b55a24ed6a17e0bb5ef762560ebb0ab152 (patch)
treec2f1da1fb577d452c58c9689c945980bdf85f0c7 /plugins/check_http.c
parentd77b785d2364d436ff66c379b3a7818a150bbcf6 (diff)
downloadmonitoring-plugins-475ee7b55a24ed6a17e0bb5ef762560ebb0ab152.tar.gz
Add "Connection: close" to the HTTP request header, which tells HTTP/1.1
servers to close the connection after completion of the response. This should be compatible with HTTP/1.0, as HTTP/1.0 allows for custom header fields which should be ignored if not recognized by the server. With some server configurations, the server would keep the connection alive without this header line (despite the plugin requesting HTTP/1.0), resulting in the plugin running into either the server's or it's own timeout (reported by Roman Schliessmeyer and Jesse Morgan via IRC). git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1759 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_http.c')
-rw-r--r--plugins/check_http.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 26a074df..b371cd64 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -782,6 +782,9 @@ check_http (void)
782 782
783 asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent); 783 asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent);
784 784
785 /* tell HTTP/1.1 servers not to keep the connection alive */
786 asprintf (&buf, "%sConnection: close\r\n", buf);
787
785 /* optionally send the host header info */ 788 /* optionally send the host header info */
786 if (host_name) 789 if (host_name)
787 asprintf (&buf, "%sHost: %s\r\n", buf, host_name); 790 asprintf (&buf, "%sHost: %s\r\n", buf, host_name);