]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Feature] Add HTML URL rewriting infrastructure
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 11 Oct 2025 09:03:37 +0000 (10:03 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 11 Oct 2025 09:03:37 +0000 (10:03 +0100)
commit6452583c7a76b4374ffcfad6e0fce057f5320447
treeb0fa5df9e78f10ca34dbd918bd29051a66221548
parentb13da2ca5e11e6fff32e31cce68aba4ffdc190f5
[Feature] Add HTML URL rewriting infrastructure

Implements infrastructure for rewriting clickable URLs in HTML content:

- Add span tracking to HTML parser to capture byte offsets of href/src attribute values
- Implement patch-based URL rewriting engine with overlap validation
- Add C→Lua glue for URL rewriting callback functions
- Support MIME re-encoding (quoted-printable, base64, 8bit) for modified content
- Add configuration options: enable_url_rewrite, url_rewrite_lua_func, url_rewrite_fold_limit

The feature allows Lua callbacks to transform URLs while preserving HTML structure
and MIME encoding. Integration with milter REPLBODY support enables message body
replacement.
src/libserver/CMakeLists.txt
src/libserver/cfg_file.h
src/libserver/cfg_rcl.cxx
src/libserver/cfg_utils.cxx
src/libserver/html/html.cxx
src/libserver/html/html.hxx
src/libserver/html/html_tag.hxx
src/libserver/html/html_url_rewrite.cxx [new file with mode: 0644]
src/libserver/html/html_url_rewrite.hxx [new file with mode: 0644]