[Nagiosplug-checkins] nagiosplug/plugins check_http.c,1.108,1.109

Holger Weiss hweiss at users.sourceforge.net
Sat Jul 21 18:29:03 CEST 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7201/plugins

Modified Files:
	check_http.c 
Log Message:
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).


Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- check_http.c	17 Jun 2007 19:34:55 -0000	1.108
+++ check_http.c	21 Jul 2007 16:29:01 -0000	1.109
@@ -782,6 +782,9 @@
 
   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\r\n", buf, host_name);





More information about the Commits mailing list