From 643557a2e75bb6ea041c8c2dab41d03ddb8662ff Mon Sep 17 00:00:00 2001 From: toto Date: Thu, 5 Mar 2026 15:11:56 +0100 Subject: [PATCH] fix: skip subrequests and internal redirects in post_read_request - FIX: Guard post_read_request hook with r->main and r->prev checks to avoid logging duplicate lines for subrequests and internal redirects - DOC: Document subrequest/redirect filtering in architecture.yml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- architecture.yml | 4 ++++ mod_reqin_log.spec | 6 +++++- src/mod_reqin_log.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/architecture.yml b/architecture.yml index 6c089a1..a3ba52e 100644 --- a/architecture.yml +++ b/architecture.yml @@ -31,6 +31,10 @@ context: Log as soon as the HTTP request is fully read to capture input-side data (client/server addresses, request line, headers) without waiting for application processing. + filters: + - Subrequests (r->main != NULL) are skipped. + - Internal redirects (r->prev != NULL) are skipped. + - Only the original client request is logged. logging_scope: coverage: all-traffic description: > diff --git a/mod_reqin_log.spec b/mod_reqin_log.spec index 797ea24..fdcc09f 100644 --- a/mod_reqin_log.spec +++ b/mod_reqin_log.spec @@ -1,4 +1,4 @@ -%global spec_version 1.0.15 +%global spec_version 1.0.16 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.16 +- FIX: Skip subrequests and internal redirects to log only the original client request +- DOC: Document subrequest/redirect filtering in architecture.yml + * Thu Mar 05 2026 Developer - 1.0.15 - FIX: timestamp field now uses r->request_time (request reception time) instead of apr_time_now() - DOC: Remove unparsed_uri and fragment fields from architecture.yml (not logged) diff --git a/src/mod_reqin_log.c b/src/mod_reqin_log.c index 1054d76..2cbc2f0 100644 --- a/src/mod_reqin_log.c +++ b/src/mod_reqin_log.c @@ -900,6 +900,11 @@ static int reqin_log_post_read_request(request_rec *r) { reqin_log_server_conf_t *srv_conf = get_server_conf(r->server); + /* Skip subrequests and internal redirects to log only the original hit */ + if (r->main != NULL || r->prev != NULL) { + return DECLINED; + } + if (srv_conf == NULL || srv_conf->config == NULL || !srv_conf->config->enabled || srv_conf->config->socket_path == NULL) { return DECLINED;