diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:06:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:06:57 +0000 |
commit | a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc (patch) | |
tree | fd79d650c7ffee81608955be5f4fd8edd791834e /tests/Test-iri-percent.px | |
parent | Initial commit. (diff) | |
download | wget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.tar.xz wget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.zip |
Adding upstream version 1.20.1.upstream/1.20.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | tests/Test-iri-percent.px | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/tests/Test-iri-percent.px b/tests/Test-iri-percent.px new file mode 100755 index 0000000..65fa4d3 --- /dev/null +++ b/tests/Test-iri-percent.px @@ -0,0 +1,88 @@ +#!/usr/bin/env -S perl -I . + +use strict; +use warnings; + +use WgetFeature qw(iri); +use HTTPTest; + +# Just a sanity check to verify that %-encoded values are always left +# untouched. + +my $ccedilla_l15 = "\xE7"; +my $ccedilla_l15_pct = "%E7"; +my $ccedilla_u8 = "\xC3\xA7"; +my $ccedilla_u8_pct = "%C3%A7"; +my $eacute_l1 = "\xE9"; +my $eacute_u8 = "\xC3\xA9"; +my $eacute_u8_pct = "%C3%A9"; + +my $pageindex = <<EOF; +<html> +<head> + <title>Main Page</title> +</head> +<body> + <p> + Link to page 1 <a + href="http://localhost:{{port}}/hello_${ccedilla_l15_pct}${eacute_l1}.html">La seule page en français</a>. + </p> +</body> +</html> +EOF + +my $pagefrancais = <<EOF; +<html> +<head> + <title>La seule page en français</title> + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +</head> +<body> + <p> + </p> +</body> +</html> +EOF + +# code, msg, headers, content +my %urls = ( + '/index.html' => { + code => "200", + msg => "Ok", + headers => { + "Content-type" => "text/html; charset=ISO-8859-15", + }, + content => $pageindex, + }, + "/hello_${ccedilla_u8_pct}${eacute_u8_pct}.html" => { + code => "200", + msg => "Ok", + headers => { + "Content-type" => "text/html; charset=UTF-8", + }, + content => $pagefrancais, + }, +); + +my $cmdline = $WgetTest::WGETPATH . " --iri -e robots=off --restrict-file-names=nocontrol -nH -r http://localhost:{{port}}/"; + +my $expected_error_code = 0; + +my %expected_downloaded_files = ( + 'index.html' => { + content => $pageindex, + }, + "hello_${ccedilla_u8}${eacute_u8}.html" => { + content => $pagefrancais, + }, +); + +############################################################################### + +my $the_test = HTTPTest->new (input => \%urls, + cmdline => $cmdline, + errcode => $expected_error_code, + output => \%expected_downloaded_files); +exit $the_test->run(); + +# vim: et ts=4 sw=4 |