Update d/patch/13_check_http_fix_superflous_crlf

This commit is contained in:
Jan Wagner 2022-11-05 14:02:42 +00:00
parent 1e0e230bb2
commit b61a8ea7da

View file

@ -1,17 +1,17 @@
From 8543f8e2cd72cbdd3aa8469c86ead50824fd88a6 Mon Sep 17 00:00:00 2001
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] Remove superflous CRLF in HTTP-Requests in check_http
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 0b712665a..676cf6445 100644
index ff39c5912..a606cbed0 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -948,8 +948,7 @@ check_http (void)
@@ -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);
@ -21,7 +21,7 @@ index 0b712665a..676cf6445 100644
if (verbose) printf ("%s\n", buf);
send(sd, buf, strlen (buf), 0);
buf[0]='\0';
@@ -1050,7 +1049,7 @@ check_http (void)
@@ -1070,7 +1069,7 @@ check_http (void)
}
xasprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data));
@ -30,3 +30,37 @@ index 0b712665a..676cf6445 100644
}
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);
}