Skip to content

mod_proxy_html: URL map regex fixes, ProxyHTMLMaxBufSize, DocType with libxml2 2.14 - #1104

Merged
notroj merged 3 commits into
apache:trunkfrom
notroj:mod_proxy_html-fixes
Nov 27, 2026
Merged

notroj merged 3 commits into
apache:trunkfrom
notroj:mod_proxy_html-fixes

Conversation

@notroj

@notroj notroj commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Three independent mod_proxy_html changes, one commit each:

  • A ProxyHTMLURLMap regex which does not compile is now a configuration error, or for an interpolated (v) pattern is logged and the rule skipped for that request, instead of crashing the child. The regex flags now apply to interpolated rules, and an Rv rule without ProxyHTMLInterp is compiled as written.
  • New ProxyHTMLMaxBufSize directive (default 1M, 0 for no limit) bounding the text buffered for rewriting with ProxyHTMLExtended. A larger script, stylesheet or comment is passed through unmodified and a warning logged.
  • ProxyHTMLDocType HTML|XHTML [Legacy] is rejected when built with libxml2 2.14 or later, where htmlAttrAllowed() is a stub and the attribute tables are gone, and the enforcement code is compiled out. The HTML5, auto and custom FPI forms are unaffected.

The libxml2 check is at compile time only. I could not build against libxml2 >= 2.14 locally, so that path was only exercised by forcing the #if.

The metafix() over-read is left to #783.

🤖 Generated with Claude Code

notroj and others added 3 commits November 27, 2026 15:50
* modules/filters/mod_proxy_html.c (comp_urlmap): Set regflags for
  interpolated rules too, and fail if the regex does not compile.
  (fixup_rules): Skip a rule whose interpolated regex does not
  compile; only evaluate conditions and interpolate with
  ProxyHTMLInterp on.
  (has_request_regex): New function.
  (check_filter_init): Use fixup_rules() for an interpolated regex
  without ProxyHTMLInterp.

* test/modules/filters/test_011_proxy_html_urlmap.py: New test.

* test/modules/filters/env.py (FiltersTestSetup.__init__): Load
  mod_xml2enc and mod_proxy_html if available.
  (FiltersTestEnv.__init__): Log mod_proxy_html at debug level.
  (FiltersTestEnv.configtest): New method.

* changes-entries/proxy-html-urlmap-regex.txt: Add.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* modules/filters/mod_proxy_html.c (buffer_text): New function.
  (pcdata, pcomment): Use it.
  (pendElement, pstartElement): Reset overflow state.
  (set_maxbufsz): New function.
  (proxy_html_config, proxy_html_merge, proxy_html_cmds): Add
  ProxyHTMLMaxBufSize, defaulting to 1M.

* docs/manual/mod/mod_proxy_html.xml: Document ProxyHTMLMaxBufSize.

* test/modules/filters/test_012_proxy_html_maxbuf.py: New test.

* changes-entries/proxy-html-maxbufsize.txt: Add.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* modules/filters/mod_proxy_html.c (PROXY_HTML_ENFORCE): Define for
  libxml2 < 2.14.
  (fpi_html, fpi_html_legacy, fpi_xhtml, fpi_xhtml_legacy): Define
  only with PROXY_HTML_ENFORCE.
  (empty_elts, is_empty_elt): New, used without PROXY_HTML_ENFORCE.
  (pendElement, pstartElement): Compile element and attribute
  enforcement, and use htmlTagLookup(), only with PROXY_HTML_ENFORCE;
  drop the pragmas ignoring deprecated declarations.
  (set_doctype): Fail for the HTML and XHTML forms otherwise.

* docs/manual/mod/mod_proxy_html.xml: Document the restriction on
  ProxyHTMLDocType.

* test/modules/filters/test_013_proxy_html_doctype.py: New test.

* test/pytest_suite/t/conf/proxy.conf.in: Use the HTML5 form of
  ProxyHTMLDocType.

* changes-entries/proxy-html-doctype-libxml2.txt: Add.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
notroj added a commit to apache/httpd-tests that referenced this pull request Nov 27, 2026
"ProxyHTMLDocType HTML" is refused by an httpd built with libxml2 2.14
or later (apache/httpd#1104), so the server did not start.  The test
only checks that a doctype is added.

* t/conf/proxy.conf.in: Use "ProxyHTMLDocType HTML5".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@notroj
notroj force-pushed the mod_proxy_html-fixes branch from ce39709 to 53f3cf2 Compare November 27, 2026 16:12
@notroj
notroj merged commit 0d64f17 into apache:trunk Nov 27, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant