pkg-monitoring-plugins/debian/patches/13_check_http_fix_superflous_crlf

67 lines
2.3 KiB
Plaintext

From f089d660902b726072f4e2fe619d8647d23914d3 Mon Sep 17 00:00:00 2001
From: rincewind <rincewind@vulgrim.de>
Date: Tue, 20 Apr 2021 12:15:27 +0200
Subject: [PATCH 1/2] Remove superflous CRLF in HTTP-Requests in check_http
---
plugins/check_http.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index ff39c5912..a606cbed0 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -966,8 +966,7 @@ check_http (void)
}
asprintf (&buf, "%sProxy-Connection: keep-alive\r\n", buf);
asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
- /* we finished our request, send empty line with CRLF */
- asprintf (&buf, "%s%s", buf, CRLF);
+
if (verbose) printf ("%s\n", buf);
send(sd, buf, strlen (buf), 0);
buf[0]='\0';
@@ -1070,7 +1069,7 @@ check_http (void)
}
xasprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data));
- xasprintf (&buf, "%s%s%s", buf, http_post_data, CRLF);
+ xasprintf (&buf, "%s%s", buf, http_post_data);
}
else {
/* or just a newline so the server knows we're done with the request */
From 0ac75e22bb729ca3adcc355aba8d451ce3a41c4e Mon Sep 17 00:00:00 2001
From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com>
Date: Fri, 4 Nov 2022 12:41:08 +0100
Subject: [PATCH 2/2] Readd some end of lines
---
plugins/check_http.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/check_http.c b/plugins/check_http.c
index a606cbed0..41d478163 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -966,7 +966,8 @@ check_http (void)
}
asprintf (&buf, "%sProxy-Connection: keep-alive\r\n", buf);
asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
-
+ /* we finished our request, send empty line with CRLF */
+ asprintf (&buf, "%s%s", buf, CRLF);
if (verbose) printf ("%s\n", buf);
send(sd, buf, strlen (buf), 0);
buf[0]='\0';
@@ -1070,8 +1071,7 @@ check_http (void)
xasprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data));
xasprintf (&buf, "%s%s", buf, http_post_data);
- }
- else {
+ } else {
/* or just a newline so the server knows we're done with the request */
xasprintf (&buf, "%s%s", buf, CRLF);
}