[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/03: connection: added helper macro
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/03: connection: added helper macro |
Date: |
Wed, 27 Sep 2023 18:45:09 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 837263e790953b3e5d1651ff3ae4bf963983f934
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Sep 26 17:05:08 2023 +0300
connection: added helper macro
---
src/microhttpd/connection.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 83615eb4..104678fe 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -56,6 +56,14 @@
#include "mhd_send.h"
#include "mhd_assert.h"
+/**
+ * Get whether bare LF in HTTP header and other protocol elements
+ * should be treated as the line termination depending on the configured
+ * strictness level.
+ * RFC 9112, section 2.2
+ */
+#define MHD_ALLOW_BARE_LF_AS_CRLF_(discp_lvl) (0 >= discp_lvl)
+
/**
* The reasonable length of the upload chunk "header" (the size specifier
* with optional chunk extension).
@@ -4868,7 +4876,7 @@ get_request_line_inner (struct MHD_Connection *c)
(skip_empty_lines && (-3 >= discp_lvl));
/* Treat bare LF as the end of the line.
RFC 9112, section 2.2 */
- const bool bare_lf_as_crlf = (0 >= discp_lvl);
+ const bool bare_lf_as_crlf = MHD_ALLOW_BARE_LF_AS_CRLF_ (discp_lvl);
/* Treat tab as whitespace delimiter.
RFC 9112, section 3 */
const bool tab_as_wsp = (0 >= discp_lvl);
@@ -5674,7 +5682,7 @@ get_req_header (struct MHD_Connection *c,
RFC 9112, section 2.2-3
Note: MHD never replaces bare LF with space (RFC 9110, section 5.5-5).
Bare LF is processed as end of the line or rejected as broken request. */
- const bool bare_lf_as_crlf = (0 >= discp_lvl);
+ const bool bare_lf_as_crlf = MHD_ALLOW_BARE_LF_AS_CRLF_ (discp_lvl);
/* Keep bare CR character as is.
Violates RFC 9112, section 2.2-4 */
const bool bare_cr_keep = (-3 >= discp_lvl);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.