summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/apache/pr64339.t
diff options
context:
space:
mode:
Diffstat (limited to 'debian/perl-framework/t/apache/pr64339.t')
-rw-r--r--debian/perl-framework/t/apache/pr64339.t46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/perl-framework/t/apache/pr64339.t b/debian/perl-framework/t/apache/pr64339.t
new file mode 100644
index 0000000..00097e6
--- /dev/null
+++ b/debian/perl-framework/t/apache/pr64339.t
@@ -0,0 +1,46 @@
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest;
+
+my @testcases = (
+ # Backend sends Content-Type: application/xml; charset=utf-8
+ ['/doc.xml', "application/xml; charset=utf-8", "fóó\n" ],
+
+ # Backend sends Content-Type: application/foo+xml; charset=utf-8
+ ['/doc.fooxml', "application/foo+xml; charset=utf-8", "fóó\n" ],
+
+ # Backend sends Content-Type: application/notreallyxml (no charset)
+ # This should NOT be transformed or have a charset added.
+ ['/doc.notxml', "application/notreallyxml", "f\xf3\xf3\n" ],
+
+ # Sent with charset=ISO-8859-1 - should be transformed to utf-8
+ ['/doc.isohtml', "text/html;charset=utf-8", "<html><body><p>fóó\n</p></body></html>" ],
+);
+
+# mod_xml2enc on trunk behaves quite differently to the 2.4.x version
+# after r1785780, and does NOT transform the response body. Unclear if
+# this is a regression, so restricting this test to 2.4.x (for now).
+
+if (have_min_apache_version('2.5.0')) {
+ print "1..0 # skip: Test only valid for 2.4.x";
+ exit 0;
+}
+
+if (not have_min_apache_version('2.4.59')) {
+ print "1..0 # skip: Test not valid before 2.4.59";
+ exit 0;
+}
+
+plan tests => (3*scalar @testcases), need [qw(xml2enc alias proxy_html proxy)];
+
+foreach my $t (@testcases) {
+ my $r = GET("/modules/xml2enc/front".$t->[0]);
+
+ ok t_cmp($r->code, 200, "fetching ".$t->[0]);
+ ok t_cmp($r->header('Content-Type'), $t->[1], "content-type header test for ".$t->[0]);
+ ok t_cmp($r->content, $t->[2], "content test for ".$t->[0]);
+}