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>
This commit is contained in:
toto
2026-03-05 15:11:56 +01:00
parent 54d210978f
commit 643557a2e7
3 changed files with 14 additions and 1 deletions

View File

@ -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: >

View File

@ -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 <dev@example.com> - 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 <dev@example.com> - 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)

View File

@ -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;