From f018f0e1f6f713de756f0e1bbbe992911f62b63a Mon Sep 17 00:00:00 2001 From: toto Date: Thu, 5 Mar 2026 15:29:53 +0100 Subject: [PATCH] fix: JsonSockLogMaxHeaders counts configured headers by position The limit now applies to the position in the configured list, not to the number of headers actually present in the request. This matches the documented behavior: headers beyond position N are never logged regardless of their presence. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- mod_reqin_log.spec | 6 +++++- src/mod_reqin_log.c | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mod_reqin_log.spec b/mod_reqin_log.spec index fea4fd5..76f30f3 100644 --- a/mod_reqin_log.spec +++ b/mod_reqin_log.spec @@ -1,4 +1,4 @@ -%global spec_version 1.0.17 +%global spec_version 1.0.18 Name: mod_reqin_log Version: %{spec_version} @@ -37,6 +37,10 @@ install -m 644 %{_pkgroot}/%{_sysconfdir}/httpd/conf.d/mod_reqin_log.conf %{buil %doc %{_docdir}/%{name} %changelog +* Thu Mar 05 2026 Developer - 1.0.18 +- FIX: JsonSockLogMaxHeaders now counts configured headers (by position in list) + regardless of their presence in the request, matching the documented behavior + * Thu Mar 05 2026 Developer - 1.0.17 - CONFIG: Extend default JsonSockLogHeaders list (User-Agent, Referer, X-Forwarded-For, Sec-CH-UA*, Sec-Fetch-*, Accept, Accept-Language, Accept-Encoding) diff --git a/src/mod_reqin_log.c b/src/mod_reqin_log.c index 2cbc2f0..95b251c 100644 --- a/src/mod_reqin_log.c +++ b/src/mod_reqin_log.c @@ -837,6 +837,9 @@ static void log_request(request_rec *r, reqin_log_config_t *cfg, reqin_log_child continue; } + /* Count against the limit regardless of header presence in the request */ + header_count++; + header_value = get_header(r, header_name); if (header_value != NULL) { @@ -864,8 +867,6 @@ static void log_request(request_rec *r, reqin_log_config_t *cfg, reqin_log_child truncated = apr_pstrmemdup(pool, header_value, val_len); append_json_string(&buf, truncated); dynbuf_append(&buf, "\"", 1); - - header_count++; } } }