Adding d/p/21_check_http_faster_with_large_files from upstream
This commit is contained in:
parent
f9e79dedec
commit
f95110eb99
37
debian/patches/21_check_http_faster_with_large_files
vendored
Normal file
37
debian/patches/21_check_http_faster_with_large_files
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
From 763862a61cf5a7ba1a10f607022aac2434c79f57 Mon Sep 17 00:00:00 2001
|
||||
From: Danijel Tasov <data@consol.de>
|
||||
Date: Wed, 21 Dec 2022 14:48:11 +0100
|
||||
Subject: [PATCH] make check_http faster with larger files
|
||||
|
||||
The current implementation becomes exponentially slower with growing
|
||||
response size.
|
||||
|
||||
See also:
|
||||
|
||||
https://github.com/nagios-plugins/nagios-plugins/blob/release-2.4.2/plugins/check_http.c#L1199-L1204
|
||||
|
||||
---
|
||||
plugins/check_http.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/plugins/check_http.c b/plugins/check_http.c
|
||||
index 41d478163..1835a2d09 100644
|
||||
--- a/plugins/check_http.c
|
||||
+++ b/plugins/check_http.c
|
||||
@@ -1095,9 +1095,14 @@ check_http (void)
|
||||
*pos = ' ';
|
||||
}
|
||||
buffer[i] = '\0';
|
||||
- xasprintf (&full_page_new, "%s%s", full_page, buffer);
|
||||
- free (full_page);
|
||||
+
|
||||
+ if ((full_page_new = realloc(full_page, pagesize + i + 1)) == NULL)
|
||||
+ die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate memory for full_page\n"));
|
||||
+
|
||||
+ memmove(&full_page_new[pagesize], buffer, i + 1);
|
||||
+
|
||||
full_page = full_page_new;
|
||||
+
|
||||
pagesize += i;
|
||||
|
||||
if (no_body && document_headers_done (full_page)) {
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
|
@ -9,3 +9,4 @@
|
|||
18_check_icmp_help
|
||||
19_check_disk_fs_usage
|
||||
20_check_apt_unknown_escape_sequence
|
||||
21_check_http_faster_with_large_files
|
||||
|
|
Loading…
Reference in a new issue