diff options
author | Perlbotics <perlbotix@cpan.org> | 2022-06-07 11:18:57 +0200 |
---|---|---|
committer | Olaf Alders <olaf@wundersolutions.com> | 2022-07-04 16:47:40 -0400 |
commit | f4183117b1b19fc66918a2ea0b8db0527884870e (patch) | |
tree | fed37d269ba0b623747133eaeaa76ee3848e1f2d /t/old-base.t | |
parent | a75a5f8e237be8be1e6d8c3ae5bb72c6ff4663d3 (diff) | |
download | uri-f4183117b1b19fc66918a2ea0b8db0527884870e.tar.gz |
uri-test: use local implementation (./lib) while authoring module
bugfix #99: Square brackets in path element not escaped.
Hopefully fixes issue#99 w/o breaking new stuff.
https://github.com/libwww-perl/URI/issues/99
Setting the environment variable URI_RESERVED_SQUARE_BRACKETS=1
restores the old behaviour (5.10 and before).
See section ENVIRONMENT VARIABLES of the URI.pm perldoc.
Tests for issue#99: Square brackets in path element not escaped.
Not complete yet. See #TODO.
t/old-base.t adapted to match new and legacy behavior
Fixed typos in POD of URI.pm
more tests, esp. getter validation
userinfo(): setter escapes according to RFC 3987
authority(): setter escapes userinfo part separately from host part
authority(): IPv6 detection for host part (should use Regexp::IPv6)
URI.pm: POD fixed
uri-test: explicit use of ./lib replaced by visual warning
See: https://github.com/libwww-perl/URI/pull/100#discussion_r903497606
POD corrections and clarifications.
See: https://github.com/libwww-perl/URI/pull/100#discussion_r895442979
https://github.com/libwww-perl/URI/pull/100#discussion_r895443302
https://github.com/libwww-perl/URI/pull/100#discussion_r903515373
Unused global variable removed.
See: https://github.com/libwww-perl/URI/pull/100#discussion_r895978559
_generic.pm: uses Regexp::IPv6 if installed, fallback otherwise
The fallback regexp is just a check for the minimum amount of
legal characters. Extra check is used to ensure that at least
two colons are present.
See: https://github.com/libwww-perl/URI/pull/100#discussion_r903810999
Another try to get POD spehlink rait.
cpanfile: Regexp::IPv6 is suggested at runtime
Spelling fixed and comments updated. Thanks, @simbabque.
Diffstat (limited to 't/old-base.t')
-rw-r--r-- | t/old-base.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/old-base.t b/t/old-base.t index 706051a..bef71eb 100644 --- a/t/old-base.t +++ b/t/old-base.t @@ -552,7 +552,13 @@ sub escape_test { is($all, $new, "uri_escape->uri_unescape"), $url->path($all); - is($url->full_path, q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF), ref($url) . '->as_string'); + + if ( URI::HAS_RESERVED_SQUARE_BRACKETS ) { + # legacy: this was legal before '[' and ']' were restricted to the host part of the URI (see: RFC 3513 & RFC 3986) + is($url->full_path, q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF), ref($url) . '->as_string'); + } else { + is($url->full_path, q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF), ref($url) . '->as_string'); + } # test escaping uses uppercase (preferred by rfc1837) $url = new URI::URL 'file://h/'; |