Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Perl build artifacts
MYMETA.json
MYMETA.yml
Makefile
blib/
pm_to_blib

# C modules build artifacts
c-modules/Makefile
c-modules/apache_httpd_test.h
c-modules/*/.libs/
c-modules/*/Makefile
c-modules/*/*.slo

# Apache Test generated files
t/REPORT
t/SMOKE
t/TEST
t/conf/apache_test_config.pm
t/conf/*.conf
t/conf/ssl/*.pl
t/conf/ssl/*.conf
t/logs/

# Generated test scripts
t/htdocs/**/*.pl
t/htdocs/modules/access/htaccess/.htaccess
27 changes: 0 additions & 27 deletions t/conf/extra.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -1582,30 +1582,3 @@ LimitRequestFields 32
OutputSed "s/foo/barbarbarbar/g"
</Location>
</IfModule>

#
# t/apache/pr64339.t test configuration
#
<IfModule mod_xml2enc.c>
<IfModule mod_proxy_html.c>
<IfModule mod_proxy.c>
Alias /modules/xml2enc/back @SERVERROOT@/htdocs/modules/xml2enc
<Location /modules/xml2enc/back>
AddType application/foo+xml fooxml
AddType application/notreallyxml notxml
AddType application/xml xml
AddType text/html isohtml
AddCharset ISO-8859-1 .isohtml
AddCharset UTF-8 .xml
AddCharset UTF-8 .fooxml
</Location>
<Location /modules/xml2enc/front>
ProxyHTMLEnable on
# mod_proxy_html needs some configuration.
ProxyHTMLURLMap / /blah
ProxyHTMLLinks a href
ProxyPass http://@SERVERNAME@:@PORT@/modules/xml2enc/back
</Location>
</IfModule>
</IfModule>
</IfModule>
143 changes: 142 additions & 1 deletion t/conf/proxy.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,145 @@ Alias /modules/proxy/fcgi-uds-sethandler @SERVERROOT@/htdocs/modules/proxy/fcgi
SetHandler "proxy:unix:/tmp/apache-test-builtinfcgi.sock|fcgi://unused"
</LocationMatch>


#
# Tests for mod_proxy_html, mod_xml2enc test configuration
#
<IfModule mod_xml2enc.c>
<IfModule mod_proxy_html.c>
<IfModule mod_proxy.c>
# Specific config for apache/pr64339.t
Alias /modules/xml2enc/back @SERVERROOT@/htdocs/modules/xml2enc
<Location /modules/xml2enc/back>
AddType application/foo+xml fooxml
AddType application/notreallyxml notxml
AddType application/xml xml
AddType text/html isohtml
AddCharset ISO-8859-1 .isohtml
AddCharset UTF-8 .xml
AddCharset UTF-8 .fooxml
</Location>
<Location /modules/xml2enc/front>
ProxyHTMLEnable on
# mod_proxy_html needs some configuration.
ProxyHTMLURLMap / /blah
ProxyHTMLLinks a href
ProxyPass http://@SERVERNAME@:@PORT@/modules/xml2enc/back
</Location>

<Location /modules/html_proxy>
ProxyHTMLEnable on
ProxyHTMLExtended on
ProxyHtmlLinks a href
ProxyHTMLMeta on
ProxyHTMLUrlMap http://a.example.com/ http://b.example.com/ Ri
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Basic URL rewriting test
<Location /modules/html_proxy/url_rewrite>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLLinks img src
ProxyHTMLLinks form action
ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Regex URL rewriting test
<Location /modules/html_proxy/regex_rewrite>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLURLMap (http://)(server[0-9]+\.example\.com)/(.*) $1www.example.com/$2/$3 R
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Multiple HTML elements test
<Location /modules/html_proxy/links_elements>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLLinks img src
ProxyHTMLLinks link href
ProxyHTMLLinks script src
ProxyHTMLLinks area href
ProxyHTMLLinks form action
ProxyHTMLLinks object data
ProxyHTMLURLMap http://a.example.com/ http://rewritten.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Inline script/CSS rewriting test (ProxyHTMLExtended)
<Location /modules/html_proxy/inline_script>
ProxyHTMLEnable on
ProxyHTMLExtended on
ProxyHTMLLinks a href
ProxyHTMLEvents onclick onload
ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Comment stripping test
<Location /modules/html_proxy/comments_strip>
ProxyHTMLEnable on
ProxyHTMLStripComments on
ProxyHTMLLinks a href
ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Comment preservation test
<Location /modules/html_proxy/comments_keep>
ProxyHTMLEnable on
ProxyHTMLStripComments off
ProxyHTMLLinks a href
ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Fixups lowercase test
<Location /modules/html_proxy/fixups_case>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLFixups lowercase
ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Fixups dospath test (just tests backslash conversion)
<Location /modules/html_proxy/fixups_dospath>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLLinks img src
ProxyHTMLFixups dospath
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# DocType test
<Location /modules/html_proxy/doctype>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLDocType HTML
ProxyHTMLURLMap http://a.example.com/ http://b.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Case-insensitive URL mapping test
<Location /modules/html_proxy/case_insensitive>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLURLMap http://a.example.com/ http://b.example.com/ Ri
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

# Multiple URL maps test
<Location /modules/html_proxy/multiple_maps>
ProxyHTMLEnable on
ProxyHTMLLinks a href
ProxyHTMLURLMap http://a.example.com/ http://new-a.example.com/
ProxyHTMLURLMap http://c.example.com/ http://new-c.example.com/
ProxyHTMLURLMap http://d.example.com/ http://new-d.example.com/
ProxyPass http://@SERVERNAME@:@PORT@/modules/proxy_html
</Location>

</IfModule>
</IfModule>
</IfModule>
11 changes: 11 additions & 0 deletions t/htdocs/modules/proxy_html/case_insensitive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Case Insensitive Test</title>
</head>
<body>
<a href="http://A.EXAMPLE.COM/page.html">Uppercase Host</a>
<a href="http://a.EXAMPLE.com/page.html">Mixed Case Host</a>
<a href="http://a.example.com/page.html">Lowercase Host</a>
</body>
</html>
16 changes: 16 additions & 0 deletions t/htdocs/modules/proxy_html/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Comments Test</title>
</head>
<body>
<!-- This is a comment that should be stripped -->
<p>Visible content</p>
<!-- Another comment
spanning multiple lines -->
<div>More content</div>
<!--[if IE]>
<p>IE specific content</p>
<![endif]-->
</body>
</html>
9 changes: 9 additions & 0 deletions t/htdocs/modules/proxy_html/doctype.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<title>DocType Test</title>
</head>
<body>
<p>Document without DOCTYPE - should get one added</p>
<a href="http://a.example.com/page.html">Link</a>
</body>
</html>
1 change: 1 addition & 0 deletions t/htdocs/modules/proxy_html/equiv.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta content="X" http-equiv = 999 >
10 changes: 10 additions & 0 deletions t/htdocs/modules/proxy_html/fixups_case.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Fixups Case Test</title>
</head>
<body>
<a href="http://a.example.com/Path/With/CAPS.html">Mixed Case</a>
<a href="http://a.example.com/ALL/UPPERCASE.HTML">All Caps</a>
</body>
</html>
10 changes: 10 additions & 0 deletions t/htdocs/modules/proxy_html/fixups_dospath.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>Fixups DOS Path Test</title>
</head>
<body>
<a href="http://a.example.com\path\with\backslashes.html">Backslashes</a>
<img src="http://a.example.com\images\photo.jpg" alt="Photo">
</body>
</html>
16 changes: 16 additions & 0 deletions t/htdocs/modules/proxy_html/inline_script.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Inline Script Test</title>
<style>
body { background: url('http://a.example.com/bg.png'); }
</style>
<script>
var url = 'http://a.example.com/data.json';
window.location.href = 'http://a.example.com/redirect.html';
</script>
</head>
<body onload="fetch('http://a.example.com/api')">
<a href="#" onclick="window.open('http://a.example.com/popup.html')">Click</a>
</body>
</html>
15 changes: 15 additions & 0 deletions t/htdocs/modules/proxy_html/links_elements.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Links Elements Test</title>
<link rel="stylesheet" href="http://a.example.com/style.css">
<script src="http://a.example.com/script.js"></script>
</head>
<body>
<a href="http://a.example.com/page.html">Anchor</a>
<img src="http://a.example.com/img.jpg" alt="Image">
<area href="http://a.example.com/map.html" alt="Area">
<form action="http://a.example.com/form" method="post"></form>
<object data="http://a.example.com/object.swf"></object>
</body>
</html>
11 changes: 11 additions & 0 deletions t/htdocs/modules/proxy_html/meta_contenttype.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="X-Other" content="OtherValue">
<title>Content-Type Meta Test</title>
</head>
<body>
<p>Test for Content-Type meta tag handling</p>
</body>
</html>
11 changes: 11 additions & 0 deletions t/htdocs/modules/proxy_html/meta_edge_cases.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-Empty-Content" content="">
<meta http-equiv="X-Very-Long-Name-With-Many-Characters" content="LongNameTest">
<meta http-equiv="X-End" content="LastValue"><title>Edge Cases</title>
</head>
<body>
<p>Test for edge cases in meta tag parsing</p>
</body>
</html>
14 changes: 14 additions & 0 deletions t/htdocs/modules/proxy_html/meta_malformed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-Valid" content="ValidValue">
<meta http-equiv="X-No-Content">
<meta http-equiv="">
<meta content="ContentOnly">
<meta http-equiv="X-After-Bad" content="AfterBad">
<title>Malformed Meta Test</title>
</head>
<body>
<p>Test for malformed meta tags that should be handled safely</p>
</body>
</html>
14 changes: 14 additions & 0 deletions t/htdocs/modules/proxy_html/meta_multiple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-First" content="First">
<meta http-equiv="X-Second" content="Second">
<meta http-equiv="X-Third" content="Third">
<meta name="description" content="This should be ignored">
<meta http-equiv="X-Fourth" content="Fourth">
<title>Multiple Meta Test</title>
</head>
<body>
<p>Test for multiple meta http-equiv tags</p>
</body>
</html>
12 changes: 12 additions & 0 deletions t/htdocs/modules/proxy_html/meta_quotes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-Double-Quote" content="Value with double quotes">
<meta http-equiv='X-Single-Quote' content='Value with single quotes'>
<meta http-equiv="X-No-Quote" content=ValueNoQuotes>
<title>Meta Quotes Test</title>
</head>
<body>
<p>Test for different quote styles in meta tags</p>
</body>
</html>
10 changes: 10 additions & 0 deletions t/htdocs/modules/proxy_html/meta_simple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-Custom-Header" content="SimpleValue">
<title>Simple Meta Test</title>
</head>
<body>
<p>Test for simple meta http-equiv extraction</p>
</body>
</html>
12 changes: 12 additions & 0 deletions t/htdocs/modules/proxy_html/meta_special_chars.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-Special" content="Value-with-dashes">
<meta http-equiv="X-Numbers123" content="123">
<meta http-equiv="X-Mixed" content="text/html; charset=utf-8">
<title>Special Characters Test</title>
</head>
<body>
<p>Test for special characters in meta tags</p>
</body>
</html>
Loading
Loading