Prechádzať zdrojové kódy

check_http: fix parsing the last header

The header that has no newline trailing it, is the last header.

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
Patrick Uiterwijk 9 rokov pred
rodič
commit
715aa5a85e
1 zmenil súbory, kde vykonal 2 pridanie a 1 odobranie
  1. 2 1
      plugins/check_http.c

+ 2 - 1
plugins/check_http.c

@@ -750,7 +750,8 @@ header_value (const char *headers, const char *header)
 
 
   value_end = strchr(s, '\r');
   value_end = strchr(s, '\r');
   if (!value_end) {
   if (!value_end) {
-      die (STATE_UNKNOWN, _("HTTP_UNKNOWN - Failed to parse response headers\n"));
+      // Turns out there's no newline after the header... So it's at the end!
+      value_end = s + strlen(s);
   }
   }
 
 
   value_size = value_end - s;
   value_size = value_end - s;