Skip to content
Browse files

Modifying UTF-8 domain name test to allow punycoded response

  • Loading branch information...
1 parent a733c74 commit 1a171ab1b5591e17a356501a096647d9b1977428 @snark committed Nov 24, 2009
Showing with 5 additions and 3 deletions.
  1. +5 −3 t/uri.t
View
8 t/uri.t
@@ -31,8 +31,10 @@ note 'UTF-8 handling in URLs';
# Arrow used in tinyarro.ws is %E2%9E%A1 / \x{27a1}
is( $l->clean(q{<A HREF="http://ja.wikipedia.org/wiki/黒澤明"></a>}), q{<a href="http://ja.wikipedia.org/wiki/%E9%BB%92%E6%BE%A4%E6%98%8E"></a>}, 'UTF-8 path is escaped');
-is( $l->clean( q{<a href="http://➡.ws/Լ䘅">JAPH</a>} ), qq{<a href="http://\x{27a1}.ws/%D4%BC%E4%98%85">JAPH</a>}, 'UTF-8-heavy URL is passed through, returned with UTF-8 domain and escaped path');
-is( $l->clean(q{<a href="http://➡.WS:80/Լ䘅">JAPH</a>}), qq{<a href="http://\x{27a1}.ws/%D4%BC%E4%98%85">JAPH</a>}, 'UTF-8-heavy URL is canonical-ized');
+my $heavy = $l->clean(q{<a href="http://➡.ws/Լ䘅">JAPH</a>});
+ok( ( $heavy eq qq{<a href="http://\x{27a1}.ws/%D4%BC%E4%98%85">JAPH</a>} or $heavy eq q{<a href="http://xn--4ag7q.ws/%D4%BC%E4%98%85">JAPH</a>}), 'UTF-8-heavy URL is passed through, returned with UTF-8 domain and escaped path');
+$heavy = $l->clean(q{<a href="http://➡.ws:80/Լ䘅">JAPH</a>});
+ok( ( $heavy eq qq{<a href="http://\x{27a1}.ws/%D4%BC%E4%98%85">JAPH</a>} or $heavy eq q{<a href="http://xn--4ag7q.ws/%D4%BC%E4%98%85">JAPH</a>}), 'UTF-8-heavy URL is canonical-ized');
TODO: {
local $TODO = q{Haven't added in use of Net::LibIDN or Net::DNS::IDNA yet};
is( $l->clean(q{<A HREF="http://π.cr.yp.to/" />}), q{<a href="http://xn--1xa.cr.yp.to/"></a>}, '<a href> with UTF-8 domain name is Punycode escaped');
@@ -88,4 +90,4 @@ S
}), q{<img />}, '<img> with multiline JS is neutralized');
is( $l->clean(q{<IMG SRC="javascript:alert('黒澤明');">}), q{<img />}, 'UTF-8 URL does not prevent sanitization');
-# http://imfo.ru/csstest/css_hacks/import.php
+# http://imfo.ru/csstest/css_hacks/import.php

0 comments on commit 1a171ab

Please sign in to comment.
Something went wrong with that request. Please try again.