diff --git a/v1/test/cases/testdata/v1/uribuiltins/test-uribuiltins-0003.yaml b/v1/test/cases/testdata/v1/uribuiltins/test-uribuiltins-0003.yaml new file mode 100644 index 0000000000..b49055b71b --- /dev/null +++ b/v1/test/cases/testdata/v1/uribuiltins/test-uribuiltins-0003.yaml @@ -0,0 +1,100 @@ +--- +cases: + # --- host component: percent-escapes may only encode non-ASCII bytes ------- + # RFC 3986 §3.2.2 / RFC 6874 §2: in the host, %-encoding is reserved for + # non-ASCII bytes, with %25 permitted for IPv6 zone identifiers. Decoding an + # ASCII escape here would silently normalise the host (exa%6dple.com -> + # example.com), so it must be rejected rather than decoded. + - note: uribuiltins/is_valid percent-encoded ascii in host + query: uri.is_valid("http://exa%6dple.com/", x) + want_result: + - x: false + - note: uribuiltins/parse percent-encoded ascii in host + query: uri.parse("http://exa%6dple.com/", x) + want_error_code: eval_builtin_error + want_error: 'uri.parse: parse "http://exa%6dple.com/": invalid URL escape "%6d"' + strict_error: true + + # --- userinfo must be validated, not just discarded ----------------------- + - note: uribuiltins/is_valid invalid userinfo + query: uri.is_valid("http://a