(httpd-tests) branch trunk updated: test: add mod_proxy_html comment-after-rewrite regression tests
[email protected] Mon, 06 Jul 2026 09:23:02 +0000
| Newsgroups | gmane.comp.apache.cvs |
|---|---|
| Message-ID | <178332978254.117094.10877191805818545070@gitbox3-he-fi.apache.org> |
This is an automated email from the ASF dual-hosted git repository.
notroj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/httpd-tests.git
The following commit(s) were added to refs/heads/trunk by this push:
new acc83f5c test: add mod_proxy_html comment-after-rewrite regression tests
acc83f5c is described below
commit acc83f5c585164ed65a959d826f092789501258b
Author: Joe Orton <[email protected]>
AuthorDate: Mon Jul 6 10:13:00 2026 +0100
test: add mod_proxy_html comment-after-rewrite regression tests
* t/modules/proxy_html.t: Add 13 test entries covering comment
handling with URL rewriting across extfix on/off and
strip_comments on/off combinations. Guard with minver 2.4.69
so tests are skipped on older httpd versions.
Assisted-by: Claude Opus 4.6 <[email protected]>
---
t/conf/proxy.conf.in | 37 ++++++++++++++++
t/htdocs/modules/proxy_html/comment_rewrite.html | 14 ++++++
t/modules/proxy_html.t | 54 ++++++++++++++++++++++++
3 files changed, 105 insertions(+)
diff --git a/t/conf/proxy.conf.in b/t/conf/proxy.conf.in
index 5924d89c..4ec1c37b 100644
--- a/t/conf/proxy.conf.in
+++ b/t/conf/proxy.conf.in
@@ -360,6 +360,43 @@ Alias /modules/proxy/fcgi-uds-sethandler @SERVERROOT@/htdocs/modules/proxy/fcgi
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>
+ # Comment-after-rewrite test (regression for garbage after
+ # comments following rewritten URLs)
+ <Location /modules/html_proxy/comment_rewrite>
+ ProxyHTMLFixups reset
+ ProxyHTMLEnable on
+ ProxyHTMLExtended off
+ ProxyHTMLStripComments off
+ ProxyHTMLLinks a href
+ ProxyHTMLLinks link href
+ ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
+ ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
+ </Location>
+
+ # Comment stripping with extfix off
+ <Location /modules/html_proxy/comments_strip_no_extfix>
+ ProxyHTMLFixups reset
+ ProxyHTMLEnable on
+ ProxyHTMLExtended off
+ ProxyHTMLStripComments on
+ ProxyHTMLLinks a href
+ ProxyHTMLLinks link href
+ ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
+ ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
+ </Location>
+
+ # Comment-after-rewrite with extfix on
+ <Location /modules/html_proxy/comment_rewrite_extfix>
+ ProxyHTMLFixups reset
+ ProxyHTMLEnable on
+ ProxyHTMLExtended on
+ ProxyHTMLStripComments off
+ ProxyHTMLLinks a href
+ ProxyHTMLLinks link href
+ ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
+ ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
+ </Location>
+
# Multiple URL maps test
<Location /modules/html_proxy/multiple_maps>
ProxyHTMLEnable on
diff --git a/t/htdocs/modules/proxy_html/comment_rewrite.html b/t/htdocs/modules/proxy_html/comment_rewrite.html
new file mode 100644
index 00000000..bf5ea5cc
--- /dev/null
+++ b/t/htdocs/modules/proxy_html/comment_rewrite.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Comment After Rewrite Test</title>
+ <link rel="shortcut icon" type="image/png" href="http://a.example.com/static/images/favicon.png">
+ <!-- Font Awesome Icons -->
+ <link rel="stylesheet" href="http://a.example.com/static/plugins/fontawesome-free/css/all.min.css">
+</head>
+<body>
+ <a href="http://a.example.com/page1.html">Link 1</a>
+ <!-- comment after link -->
+ <a href="http://a.example.com/page2.html">Link 2</a>
+</body>
+</html>
diff --git a/t/modules/proxy_html.t b/t/modules/proxy_html.t
index 4212ebc8..bbcedc28 100644
--- a/t/modules/proxy_html.t
+++ b/t/modules/proxy_html.t
@@ -156,6 +156,55 @@ my @tests = (
{ type => 'url_rewrite', path => 'multi_subst_rx/multi_subst_rx.html',
pattern => 'RX_EVENT_END_OK', desc => 'event attr preserved after regex multi-substitution' },
+ # Comment-after-rewrite regression tests (garbage introduced after
+ # comments that follow rewritten URLs, fixed in 2.4.69)
+ { type => 'url_rewrite', path => 'comment_rewrite/comment_rewrite.html',
+ pattern => 'http://b\\.example\\.com/static/images/favicon\\.png', desc => 'rewritten URL before comment',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comment_rewrite/comment_rewrite.html',
+ pattern => '<!-- Font Awesome Icons -->', desc => 'comment preserved after rewrite',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comment_rewrite/comment_rewrite.html',
+ pattern => 'http://b\\.example\\.com/static/plugins/fontawesome-free/css/all\\.min\\.css',
+ desc => 'rewritten URL after comment not corrupted',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comment_rewrite/comment_rewrite.html',
+ pattern => '<!-- comment after link -->', desc => 'inline comment preserved after rewrite',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comment_rewrite/comment_rewrite.html',
+ pattern => '-->\\s*<link', desc => 'no garbage between comment and following tag',
+ minver => '2.4.69' },
+
+ # Comment stripping with extfix off (strip_comments=on, extfix=off)
+ { type => 'comment', path => 'comments_strip_no_extfix/comment_rewrite.html',
+ pattern => '<!-- Font Awesome Icons -->', negate => 1, desc => 'comment stripped with extfix off',
+ minver => '2.4.69' },
+ { type => 'comment', path => 'comments_strip_no_extfix/comment_rewrite.html',
+ pattern => '<!-- comment after link -->', negate => 1, desc => 'inline comment stripped with extfix off',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comments_strip_no_extfix/comment_rewrite.html',
+ pattern => 'http://b\\.example\\.com/static/images/favicon\\.png', desc => 'URL rewritten with comments stripped, extfix off',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comments_strip_no_extfix/comment_rewrite.html',
+ pattern => 'http://b\\.example\\.com/static/plugins/fontawesome-free/css/all\\.min\\.css',
+ desc => 'URL after stripped comment rewritten correctly, extfix off',
+ minver => '2.4.69' },
+
+ # Comment-after-rewrite with extfix on
+ # With extfix, pcomment accumulates into the varbuf but pstartElement
+ # resets it for attribute processing, so comments between elements
+ # are dropped. Verify URLs are still rewritten and no garbage appears.
+ { type => 'url_rewrite', path => 'comment_rewrite_extfix/comment_rewrite.html',
+ pattern => 'http://b\\.example\\.com/static/images/favicon\\.png', desc => 'URL rewritten with extfix on',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comment_rewrite_extfix/comment_rewrite.html',
+ pattern => 'http://b\\.example\\.com/static/plugins/fontawesome-free/css/all\\.min\\.css',
+ desc => 'URL after comment rewritten with extfix on',
+ minver => '2.4.69' },
+ { type => 'url_rewrite', path => 'comment_rewrite_extfix/comment_rewrite.html',
+ pattern => 'http://b\\.example\\.com/page1\\.html', desc => 'body URL rewritten with extfix on',
+ minver => '2.4.69' },
+
# Multiple URL maps tests
{ type => 'url_rewrite', path => 'multiple_maps/multiple_maps.html',
pattern => 'http://new-a\\.example\\.com/page1\\.html', desc => 'first URL map' },
@@ -165,6 +214,11 @@ my @tests = (
pattern => 'http://new-d\\.example\\.com/page3\\.html', desc => 'third URL map' },
);
+# Filter out tests which require a newer httpd version
+@tests = grep {
+ !$_->{minver} || have_min_apache_version($_->{minver})
+} @tests;
+
# Calculate total number of tests
my $total_tests = 0;
foreach my $t (@tests) {