Przeglądaj źródła

check_http.c - Add */* MIME support

Some servers do not work at all or may respond incorrectly without MIME support. This patch adds an Accept: */* for accepting all MIME types. In the future an argument may be provided to alter requested MIME types and check against the response given, this is not currently implemented.
Thanks Alex Gottschalk, patch submitted without pull request.
Spenser Reinhardt 12 lat temu
rodzic
commit
62f32ba7f3
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      plugins/check_http.c

+ 6 - 0
plugins/check_http.c

@@ -912,6 +912,12 @@ check_http (void)
       xasprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port);
   }
 
+  /* Inform server we accept any MIME type response
+   * TODO: Take an arguement to determine what type(s) to accept,
+   * so that we can alert if a response is of an invalid type.
+  */
+  xasprintf(&buf, "%sAccept: */*\r\n", buf);
+
   /* optionally send any other header tag */
   if (http_opt_headers_count) {
     for (i = 0; i < http_opt_headers_count ; i++) {