From e0811b8d78fcbb3bd14145efdae45b69765b6987 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Tue, 3 Nov 2020 14:51:59 +1000 Subject: [PATCH] Remove internal URIs module and depend on URIs.jl instead Everything from the internal URIs module has been moved to URIs.jl, with the exception of the resource() function which is HTTP specific. (request-target defined in HTTP/1.1 https://tools.ietf.org/html/rfc7230#section-5.3). This was moved into MessageRequest.jl as it appears it's only used in implementing `request()`. --- Project.toml | 2 + src/AWS4AuthRequest.jl | 2 +- src/BasicAuthRequest.jl | 2 +- src/ConnectionRequest.jl | 2 +- src/ContentTypeRequest.jl | 2 +- src/CookieRequest.jl | 2 +- src/HTTP.jl | 3 +- src/Handlers.jl | 3 +- src/MessageRequest.jl | 11 +- src/RedirectRequest.jl | 2 +- src/URIs.jl | 433 --- test/resources/cweb-urls.json | 4771 --------------------------------- test/runtests.jl | 2 - test/uri.jl | 516 ---- test/url.jl | 39 - test/urls | 203 -- 16 files changed, 20 insertions(+), 5975 deletions(-) delete mode 100644 src/URIs.jl delete mode 100644 test/resources/cweb-urls.json delete mode 100644 test/uri.jl delete mode 100644 test/url.jl delete mode 100644 test/urls diff --git a/Project.toml b/Project.toml index 801f05d0b..07bb68bed 100644 --- a/Project.toml +++ b/Project.toml @@ -9,10 +9,12 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" IniFile = "83e8ac13-25f8-5344-8a64-a9f2b223428f" MbedTLS = "739be429-bea8-5141-9913-cc70e7f3736d" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" +URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" [compat] IniFile = "0.5" MbedTLS = "0.6.8, 0.7, 1" +URIs = "1" julia = "0.7, 1" [extras] diff --git a/src/AWS4AuthRequest.jl b/src/AWS4AuthRequest.jl index 47e2eefb9..a5623966e 100644 --- a/src/AWS4AuthRequest.jl +++ b/src/AWS4AuthRequest.jl @@ -4,7 +4,7 @@ using ..Base64 using ..Dates using MbedTLS: digest, MD_SHA256, MD_MD5 import ..Layer, ..request, ..Headers -using ..URIs +using URIs using ..Pairs: getkv, setkv, rmkv import ..@debug, ..DEBUG_LEVEL diff --git a/src/BasicAuthRequest.jl b/src/BasicAuthRequest.jl index 68f5d93a0..7b64b4152 100644 --- a/src/BasicAuthRequest.jl +++ b/src/BasicAuthRequest.jl @@ -3,7 +3,7 @@ module BasicAuthRequest using ..Base64 import ..Layer, ..request -using ..URIs +using URIs using ..Pairs: getkv, setkv import ..@debug, ..DEBUG_LEVEL diff --git a/src/ConnectionRequest.jl b/src/ConnectionRequest.jl index 39821c449..6f2c71828 100644 --- a/src/ConnectionRequest.jl +++ b/src/ConnectionRequest.jl @@ -1,7 +1,7 @@ module ConnectionRequest import ..Layer, ..request -using ..URIs, ..Sockets +using URIs, ..Sockets using ..Messages using ..IOExtras using ..ConnectionPool diff --git a/src/ContentTypeRequest.jl b/src/ContentTypeRequest.jl index 5f08e3231..d2f00becc 100644 --- a/src/ContentTypeRequest.jl +++ b/src/ContentTypeRequest.jl @@ -1,7 +1,7 @@ module ContentTypeDetection import ..Layer, ..request -using ..URIs +using URIs using ..Pairs: getkv, setkv import ..sniff import ..Form diff --git a/src/CookieRequest.jl b/src/CookieRequest.jl index ac8c467d6..03cb58826 100644 --- a/src/CookieRequest.jl +++ b/src/CookieRequest.jl @@ -2,7 +2,7 @@ module CookieRequest import ..Dates import ..Layer, ..request -using ..URIs +using URIs using ..Cookies using ..Pairs: getkv, setkv import ..@debug, ..DEBUG_LEVEL diff --git a/src/HTTP.jl b/src/HTTP.jl index d5b2290fa..a1cc45ede 100644 --- a/src/HTTP.jl +++ b/src/HTTP.jl @@ -8,16 +8,15 @@ export startwrite, startread, closewrite, closeread, stack, insert, AWS4AuthLaye const DEBUG_LEVEL = Ref(0) Base.@deprecate escape escapeuri -Base.@deprecate URL URI using Base64, Sockets, Dates +using URIs include("debug.jl") include("Pairs.jl") ;using .Pairs include("IOExtras.jl") ;using .IOExtras include("Strings.jl") -include("URIs.jl") ;using .URIs include("sniff.jl") include("multipart.jl") include("Parsers.jl") ;import .Parsers: Headers, Header, diff --git a/src/Handlers.jl b/src/Handlers.jl index 676f79fe5..bd560c5b9 100644 --- a/src/Handlers.jl +++ b/src/Handlers.jl @@ -208,7 +208,8 @@ export serve, Handler, handle, RequestHandlerFunction, StreamHandlerFunction, RequestHandler, StreamHandler, Router, @register, register! -using ..Messages, ..URIs, ..Streams, ..IOExtras, ..Servers, ..Sockets +using URIs +using ..Messages, ..Streams, ..IOExtras, ..Servers, ..Sockets """ HTTP.handle(handler::HTTP.RequestHandler, ::HTTP.Request) => HTTP.Response diff --git a/src/MessageRequest.jl b/src/MessageRequest.jl index 079645644..195318f58 100644 --- a/src/MessageRequest.jl +++ b/src/MessageRequest.jl @@ -1,16 +1,23 @@ module MessageRequest -export body_is_a_stream, body_was_streamed, setuseragent! +export body_is_a_stream, body_was_streamed, setuseragent!, resource import ..Layer, ..request using ..IOExtras -using ..URIs +using URIs using ..Messages import ..Messages: bodylength import ..Headers import ..Form, ..content_type +""" +"request-target" per https://tools.ietf.org/html/rfc7230#section-5.3 +""" +resource(uri::URI) = string( isempty(uri.path) ? "/" : uri.path, + !isempty(uri.query) ? "?" : "", uri.query, + !isempty(uri.fragment) ? "#" : "", uri.fragment) + """ request(MessageLayer, method, ::URI, headers, body) -> HTTP.Response diff --git a/src/RedirectRequest.jl b/src/RedirectRequest.jl index 3a628d69d..2d087a8b3 100644 --- a/src/RedirectRequest.jl +++ b/src/RedirectRequest.jl @@ -1,7 +1,7 @@ module RedirectRequest import ..Layer, ..request -using ..URIs +using URIs using ..Messages using ..Pairs: setkv import ..Header diff --git a/src/URIs.jl b/src/URIs.jl deleted file mode 100644 index 97a7d445d..000000000 --- a/src/URIs.jl +++ /dev/null @@ -1,433 +0,0 @@ -module URIs - -export URI, - resource, queryparams, absuri, - escapeuri, unescapeuri, escapepath - -import Base.== - -using ..IOExtras -import ..@require, ..precondition_error -import ..@ensure, ..postcondition_error -import ..isnumeric, ..isletter - -include("parseutils.jl") - -struct ParseError <: Exception - msg::String -end - -""" - HTTP.URI(; scheme="", host="", port="", etc...) - HTTP.URI(str) = parse(HTTP.URI, str::String) - -A type representing a URI (e.g. a URL). Can be constructed from distinct parts using the various -supported keyword arguments, or from a string. The `HTTP.URI` constructors will automatically escape any provided -`query` arguments, typically provided as `"key"=>"value"::Pair` or `Dict("key"=>"value")`. -Note that multiple values for a single query key can provided like `Dict("key"=>["value1", "value2"])`. - -When constructing a `HTTP.URI` from a `String`, you need to first unescape that string: `HTTP.URI( HTTP.URIs.unescapeuri(str) )`. - -The `URI` struct stores the complete URI in the `uri::String` field and the -component parts in the following `SubString` fields: - * `scheme`, e.g. `"http"` or `"https"` - * `userinfo`, e.g. `"username:password"` - * `host` e.g. `"julialang.org"` - * `port` e.g. `"80"` or `""` - * `path` e.g `"/"` - * `query` e.g. `"Foo=1&Bar=2"` - * `fragment` - -The `HTTP.resource(::URI)` function returns a target-resource string for the URI -[RFC7230 5.3](https://tools.ietf.org/html/rfc7230#section-5.3). -e.g. `"\$path?\$query#\$fragment"`. - -The `HTTP.queryparams(::URI)` function returns a `Dict` containing the `query`. -""" -struct URI - uri::String - scheme::SubString{String} - userinfo::SubString{String} - host::SubString{String} - port::SubString{String} - path::SubString{String} - query::SubString{String} - fragment::SubString{String} -end - -URI(uri::URI) = uri - -const absent = SubString("absent", 1, 0) - -const emptyuri = (()->begin - uri = "" - return URI(uri, absent, absent, absent, absent, absent, absent, absent) -end)() - -URI(;kw...) = merge(emptyuri; kw...) - -const nostring = "" - -function Base.merge(uri::URI; scheme::AbstractString=uri.scheme, - userinfo::AbstractString=uri.userinfo, - host::AbstractString=uri.host, - port::Union{Integer,AbstractString}=uri.port, - path::AbstractString=uri.path, - query=uri.query, - fragment::AbstractString=uri.fragment) - - @require isempty(host) || host[end] != '/' - @require scheme in uses_authority || isempty(host) - @require !isempty(host) || isempty(port) - @require !(scheme in ["http", "https"]) || isempty(path) || path[1] == '/' - @require !isempty(path) || !isempty(query) || isempty(fragment) - - if port !== absent - port = string(port) - end - querys = query isa AbstractString ? query : escapeuri(query) - - return URI(nostring, scheme, userinfo, host, port, path, querys, fragment) -end - -# Based on regex from RFC 3986: -# https://tools.ietf.org/html/rfc3986#appendix-B -const uri_reference_regex = - [RegexAndMatchData(r"""^ - (?: ([^:/?#]+) :) ? # 1. scheme - (?: // (?: ([^/?#@]*) @) ? # 2. userinfo - (?| (?: \[ ([^:\]]*:[^\]]*) \] ) # 3. host (ipv6) - | ([^:/?#\[]*) ) # 3. host - (?: : ([^/?#]*) ) ? ) ? # 4. port - ([^?#]*) # 5. path - (?: \?([^#]*) ) ? # 6. query - (?: [#](.*) ) ? # 7. fragment - $"""x)] - -""" -https://tools.ietf.org/html/rfc3986#section-3 -""" -function parse_uri(str::AbstractString; kw...) - uri = parse_uri_reference(str; kw...) - if isempty(uri.scheme) - throw(URIs.ParseError("URI without scheme: $str")) - end - return uri -end - -""" -https://tools.ietf.org/html/rfc3986#section-4.1 -""" -function parse_uri_reference(str::Union{String, SubString{String}}; - strict = false) - uri_reference_re = uri_reference_regex[Threads.threadid()] - if !exec(uri_reference_re, str) - throw(ParseError("URI contains invalid character")) - end - uri = URI(str, group(1, uri_reference_re, str, absent), - group(2, uri_reference_re, str, absent), - group(3, uri_reference_re, str, absent), - group(4, uri_reference_re, str, absent), - group(5, uri_reference_re, str, absent), - group(6, uri_reference_re, str, absent), - group(7, uri_reference_re, str, absent)) - if strict - ensurevalid(uri) - @ensure uristring(uri) == str - end - return uri -end - -parse_uri_reference(str; strict = false) = - parse_uri_reference(SubString(str); strict = false) - -URI(str::AbstractString) = parse_uri_reference(str) - -Base.parse(::Type{URI}, str::AbstractString) = parse_uri_reference(str) - -function ensurevalid(uri::URI) - # https://tools.ietf.org/html/rfc3986#section-3.1 - # ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) - if !(uri.scheme === absent || - occursin(r"^[[:alpha:]][[:alnum:]+-.]*$", uri.scheme)) - throw(ParseError("Invalid URI scheme: $(uri.scheme)")) - end - # https://tools.ietf.org/html/rfc3986#section-3.2.2 - # unreserved / pct-encoded / sub-delims - if !(uri.host === absent || - occursin(r"^[:[:alnum:]\-._~%!$&'()*+,;=]+$", uri.host)) - throw(ParseError("Invalid URI host: $(uri.host) $uri")) - end - # https://tools.ietf.org/html/rfc3986#section-3.2.3 - # "port number in decimal" - if !(uri.port === absent || occursin(r"^\d+$", uri.port)) - throw(ParseError("Invalid URI port: $(uri.port)")) - end - - # https://tools.ietf.org/html/rfc3986#section-3.3 - # unreserved / pct-encoded / sub-delims / ":" / "@" - if !(uri.path === absent || - occursin(r"^[/[:alnum:]\-._~%!$&'()*+,;=:@]*$", uri.path)) - throw(ParseError("Invalid URI path: $(uri.path)")) - end - - # FIXME - # For compatibility with existing test/uri.jl - if !(uri.host === absent) && - (occursin("=", uri.host) || - occursin(";", uri.host) || - occursin("%", uri.host)) - throw(ParseError("Invalid URI host: $(uri.host)")) - end -end - -""" -https://tools.ietf.org/html/rfc3986#section-4.3 -""" -isabsolute(uri::URI) = - !isempty(uri.scheme) && - isempty(uri.fragment) && - (isempty(uri.host) || isempty(uri.path) || isabspath(uri)) - -""" -https://tools.ietf.org/html/rfc7230#section-5.3.1 -https://tools.ietf.org/html/rfc3986#section-3.3 -""" -isabspath(uri::URI) = startswith(uri.path, "/") && !startswith(uri.path, "//") - -==(a::URI,b::URI) = a.scheme == b.scheme && - a.host == b.host && - normalport(a) == normalport(b) && - a.path == b.path && - a.query == b.query && - a.fragment == b.fragment && - a.userinfo == b.userinfo - -""" -"request-target" per https://tools.ietf.org/html/rfc7230#section-5.3 -""" -resource(uri::URI) = string( isempty(uri.path) ? "/" : uri.path, - !isempty(uri.query) ? "?" : "", uri.query, - !isempty(uri.fragment) ? "#" : "", uri.fragment) - -normalport(uri::URI) = uri.scheme == "http" && uri.port == "80" || - uri.scheme == "https" && uri.port == "443" ? - "" : uri.port - -hoststring(h) = ':' in h ? "[$h]" : h - -Base.show(io::IO, uri::URI) = print(io, "HTTP.URI(\"", uri, "\")") - -showparts(io::IO, uri::URI) = - print(io, "HTTP.URI(\"", uri.uri, "\"\n", - " scheme = \"", uri.scheme, "\"", - uri.scheme === absent ? " (absent)" : "", ",\n", - " userinfo = \"", uri.userinfo, "\"", - uri.userinfo === absent ? " (absent)" : "", ",\n", - " host = \"", uri.host, "\"", - uri.host === absent ? " (absent)" : "", ",\n", - " port = \"", uri.port, "\"", - uri.port === absent ? " (absent)" : "", ",\n", - " path = \"", uri.path, "\"", - uri.path === absent ? " (absent)" : "", ",\n", - " query = \"", uri.query, "\"", - uri.query === absent ? " (absent)" : "", ",\n", - " fragment = \"", uri.fragment, "\"", - uri.fragment === absent ? " (absent)" : "", ")\n") - -showparts(uri::URI) = showparts(stdout, uri) - -Base.print(io::IO, u::URI) = print(io, string(u)) - -Base.string(u::URI) = u.uri === nostring ? uristring(u) : u.uri - -#isabsent(ui) = isempty(ui) && !(ui === blank) -isabsent(ui) = ui === absent - -function formaturi(io::IO, - scheme::AbstractString, - userinfo::AbstractString, - host::AbstractString, - port::AbstractString, - path::AbstractString, - query::AbstractString, - fragment::AbstractString) - - isempty(scheme) || print(io, scheme, isabsent(host) ? - ":" : "://") - isabsent(userinfo) || print(io, userinfo, "@") - isempty(host) || print(io, hoststring(host)) - isabsent(port) || print(io, ":", port) - isempty(path) || print(io, path) - isabsent(query) || print(io, "?", query) - isabsent(fragment) || print(io, "#", fragment) - - return io -end - -uristring(a...) = String(take!(formaturi(IOBuffer(), a...))) - -uristring(u::URI) = uristring(u.scheme, u.userinfo, u.host, u.port, - u.path, u.query, u.fragment) - -queryparams(uri::URI) = queryparams(uri.query) - -function queryparams(q::AbstractString) - Dict(unescapeuri(decodeplus(k)) => unescapeuri(decodeplus(v)) - for (k,v) in ([split(e, "=")..., ""][1:2] - for e in split(q, "&", keepempty=false))) -end - -# Validate known URI formats -const uses_authority = ["https", "http", "ws", "wss", "hdfs", "ftp", "gopher", "nntp", "telnet", "imap", "wais", "file", "mms", "shttp", "snews", "prospero", "rtsp", "rtspu", "rsync", "svn", "svn+ssh", "sftp" ,"nfs", "git", "git+ssh", "ldap", "s3"] -const non_hierarchical = ["gopher", "hdl", "mailto", "news", "telnet", "wais", "imap", "snews", "sip", "sips"] -const uses_query = ["http", "wais", "imap", "https", "shttp", "mms", "gopher", "rtsp", "rtspu", "sip", "sips", "ldap"] -const uses_fragment = ["hdfs", "ftp", "hdl", "http", "gopher", "news", "nntp", "wais", "https", "shttp", "snews", "file", "prospero"] - -"checks if a `HTTP.URI` is valid" -function Base.isvalid(uri::URI) - sch = uri.scheme - isempty(sch) && throw(ArgumentError("can not validate relative URI")) - if ((sch in non_hierarchical) && (i = findfirst(isequal('/'), uri.path); i !== nothing && i > 1)) || # path hierarchy not allowed - (!(sch in uses_query) && !isempty(uri.query)) || # query component not allowed - (!(sch in uses_fragment) && !isempty(uri.fragment)) || # fragment identifier component not allowed - (!(sch in uses_authority) && (!isempty(uri.host) || ("" != uri.port) || !isempty(uri.userinfo))) # authority component not allowed - return false - end - return true -end - -# RFC3986 Unreserved Characters (and '~' Unsafe per RFC1738). -@inline issafe(c::Char) = c == '-' || - c == '.' || - c == '_' || - (isascii(c) && (isletter(c) || isnumeric(c))) - -utf8_chars(str::AbstractString) = (Char(c) for c in IOExtras.bytes(str)) - -"percent-encode a string, dict, or pair for a uri" -function escapeuri end - -escapeuri(c::Char) = string('%', uppercase(string(Int(c), base=16, pad=2))) -escapeuri(str::AbstractString, safe::Function=issafe) = - join(safe(c) ? c : escapeuri(c) for c in utf8_chars(str)) - -escapeuri(bytes::Vector{UInt8}) = bytes -escapeuri(v::Number) = escapeuri(string(v)) -escapeuri(v::Symbol) = escapeuri(string(v)) - -escapeuri(key, value) = string(escapeuri(key), "=", escapeuri(value)) -escapeuri(key, values::Vector) = escapeuri(key => v for v in values) -escapeuri(query) = isempty(query) ? absent : join((escapeuri(k, v) for (k,v) in query), "&") -escapeuri(nt::NamedTuple) = escapeuri(pairs(nt)) - -decodeplus(q) = replace(q, '+' => ' ') - -"unescape a percent-encoded uri/url" -function unescapeuri(str) - occursin("%", str) || return str - out = IOBuffer() - i = 1 - io = IOBuffer(str) - while !eof(io) - c = read(io, Char) - if c == '%' - c1 = read(io, Char) - c = read(io, Char) - write(out, parse(UInt8, string(c1, c); base=16)) - else - write(out, c) - end - end - return String(take!(out)) -end - -ispathsafe(c::Char) = c == '/' || issafe(c) -escapepath(path) = escapeuri(path, ispathsafe) - -""" -Splits the path into components -See: http://tools.ietf.org/html/rfc3986#section-3.3 -""" -function splitpath(p::AbstractString) - elems = String[] - len = length(p) - len > 1 || return elems - start_ind = i = ifelse(p[1] == '/', 2, 1) - while true - c = p[i] - if c == '/' - push!(elems, p[start_ind:i-1]) - start_ind = i + 1 - elseif i == len - push!(elems, p[start_ind:i]) - end - i += 1 - (i > len || c in ('?', '#')) && break - end - return elems -end - -""" - URIs.normpath(url) - -Normalize the path portion of a URI by removing dot segments. - -Refer to: -* https://tools.ietf.org/html/rfc3986#section-5.2.4 -""" -normpath(url::URI) = - URI(scheme=url.scheme, userinfo=url.userinfo, host=url.host, port=url.port, - path=normpath(url.path), query=url.query, fragment=url.fragment) - -function normpath(p::AbstractString) - if isempty(p) || p == "/" - return p - elseif p == "." || p == ".." - return "/" - end - buf = String[] - for part in splitpath(p) - if part == "." - continue - elseif part == ".." - isempty(buf) || pop!(buf) - else - push!(buf, part) - end - end - out = join(buf, '/') - # Preserve leading and trailing slashes if present, but don't duplicate them - if startswith(p, '/') && !startswith(out, '/') - out = "/" * out - end - if (endswith(p, '/') || endswith(p, '.')) && !endswith(out, '/') - out *= "/" - end - out -end - -absuri(u, context) = absuri(URI(u), URI(context)) - -function absuri(uri::URI, context::URI) - - if !isempty(uri.host) - return uri - end - - @assert !isempty(context.scheme) - @assert !isempty(context.host) - @assert isempty(uri.port) - - return merge(context; path=uri.path, query=uri.query) -end - -function __init__() - Threads.resize_nthreads!(uri_reference_regex) - foreach(x -> Base.compile(x.re), uri_reference_regex) - foreach(initialize!, uri_reference_regex) - return -end - - -end # module diff --git a/test/resources/cweb-urls.json b/test/resources/cweb-urls.json deleted file mode 100644 index faafb106c..000000000 --- a/test/resources/cweb-urls.json +++ /dev/null @@ -1,4771 +0,0 @@ -{ - "tests": { - "origin": "https://github.com/cweb/url-testing, Copyright © 2017 Chris Weber, http://www.lookout.net , MIT Licence", - "desc": "A collection of URL test cases, compiled from Webkit's /fast/url tests, Julian Reschke, and other sources.", - "group": [ - { - "name": "anchor", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/anchor.js", - "desc": "Test cases from Webkit's fast/url/anchor.js", - "test": [ - { - "id": "1", - "name": "A U+0020 space in the fragment", - "url": "http://www.example.com/#hello, world", - "expect_url": "http://www.example.com/#hello, world" - }, - { - "id": "2", - "name": "Percent-encoding in the fragment", - "url": "http://www.example.com/#%c2%a9", - "expect_url": "http://www.example.com/#%c2%a9" - }, - { - "id": "3", - "name": "Unicode surrogates", - "url": "http://www.example.com/#\ud800\udf00ss", - "expect_url": "http://www.example.com/#\ud800\udf00ss" - }, - { - "id": "4", - "name": "illegal percent-encoding", - "url": "http://www.example.com/#%41%a", - "expect_url": "http://www.example.com/#%41%a" - }, - { - "id": "5", - "name": "Illegal Unicode half-surrogate U+D800", - "url": "http://www.example.com/#\ud800\u597D", - "expect_url": "http://www.example.com/#\uFFFD\u597D" - }, - { - "id": "6", - "name": "Illegal Unicode U+FDD0 in the fragment", - "url": "http://www.example.com/#a\uFDD0", - "expect_url": "http://www.example.com/#a\uFFFD" - }, - { - "id": "7", - "name": "An extra U+0023 NUMBER SIGN in middle of the fragment", - "url": "http://www.example.com/#asdf#qwer", - "expect_url": "http://www.example.com/#asdf#qwer" - }, - { - "id": "8", - "name": "An extra U+0023 NUMBER SIGN at the start of fragment", - "url": "http://www.example.com/##asdf", - "expect_url": "http://www.example.com/##asdf" - }, - { - "id": "9", - "name": "Extra white space characters", - "url": "http://www.example.com/#a\u000Ab\u000Dc\u0009d", - "expect_url": "http://www.example.com/#abcd" - } - ] - }, - { - "name": "file-http-base", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/file-http-base.js", - "desc": "Test cases from Webkit's fast/url/file-http-base.js", - "test": [ - { - "id": "1", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:c:\\\\foo\\\\bar.html", - "expect_rel": "file:///C:/foo/bar.html" - }, - { - "id": "2", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": " File:c|////foo\\\\bar.html", - "expect_rel": "file:///C:////foo/bar.html" - }, - { - "id": "3", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:", - "expect_rel": "file:///" - }, - { - "id": "4", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:UNChost/path", - "expect_rel": "file://unchost/path" - }, - { - "id": "5", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "c:\\\\foo\\\\bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "6", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "C|/foo/bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "7", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "/C|\\\\foo\\\\bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "8", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "//C|/foo/bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "10", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "\\\\\\\\server\\\\file", - "expect_rel": "file://server/file" - }, - { - "id": "11", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "/\\\\server/file", - "expect_rel": "file://server/file" - }, - { - "id": "12", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:c:foo/bar.html", - "expect_rel": "file:///C:/foo/bar.html" - }, - { - "id": "13", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html", - "expect_rel": "file:///C:////foo/bar.html" - }, - { - "id": "14", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:///foo/bar.txt", - "expect_rel": "file:///foo/bar.txt" - }, - { - "id": "15", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html", - "expect_rel": "file://7:////foo/bar.html" - }, - { - "id": "16", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:filer/home\\\\me", - "expect_rel": "file://filer/home/me" - }, - { - "id": "17", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:///C:/foo/../../../bar.html", - "expect_rel": "file:///C:/bar.html" - }, - { - "id": "18", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:///C:/asdf#\\%c2", - "expect_rel": "file:///C:/asdf#\\%ef\\%bf\\%bd" - }, - { - "id": "19", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:///home/me", - "expect_rel": "file:///home/me" - }, - { - "id": "20", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:c:\\\\foo\\\\bar.html", - "expect_rel": "file:///c:/foo/bar.html" - }, - { - "id": "21", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file:c|//foo\\\\bar.html", - "expect_rel": "file:///c%7C//foo/bar.html" - }, - { - "id": "25", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file://test", - "expect_rel": "file://test/" - }, - { - "id": "26", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file://localhost/", - "expect_rel": "file://localhost/" - }, - { - "id": "27", - "name": "", - "base": "http://www.example.com/foo/bar", - "rel": "file://localhost/test", - "expect_rel": "file://localhost/test" - } - ] - }, - { - "name": "file", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/file.js", - "desc": "Test cases from Webkit's fast/url/file.js", - "test": [ - { - "id": "1", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:c:\\\\foo\\\\bar.html", - "expect_rel": "file:///C:/foo/bar.html" - }, - { - "id": "2", - "name": "", - "base": "file:///tmp/mock/path", - "rel": " File:c|////foo\\\\bar.html", - "expect_rel": "file:///C:////foo/bar.html" - }, - { - "id": "3", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:", - "expect_rel": "file:///" - }, - { - "id": "4", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:UNChost/path", - "expect_rel": "file://unchost/path" - }, - { - "id": "5", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "c:\\\\foo\\\\bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "6", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "C|/foo/bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "7", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "/C|\\\\foo\\\\bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "8", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "//C|/foo/bar", - "expect_rel": "file:///C:/foo/bar" - }, - { - "id": "9", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "//server/file", - "expect_rel": "file://server/file" - }, - { - "id": "10", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "\\\\\\\\server\\\\file", - "expect_rel": "file://server/file" - }, - { - "id": "11", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "/\\\\server/file", - "expect_rel": "file://server/file" - }, - { - "id": "12", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:c:foo/bar.html", - "expect_rel": "file:///C:/foo/bar.html" - }, - { - "id": "13", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html", - "expect_rel": "file:///C:////foo/bar.html" - }, - { - "id": "14", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:///foo/bar.txt", - "expect_rel": "file:///foo/bar.txt" - }, - { - "id": "15", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html", - "expect_rel": "file://7:////foo/bar.html" - }, - { - "id": "16", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:filer/home\\\\me", - "expect_rel": "file://filer/home/me" - }, - { - "id": "17", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:///C:/foo/../../../bar.html", - "expect_rel": "file:///C:/bar.html" - }, - { - "id": "18", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:///C:/asdf#\\%c2", - "expect_rel": "file:///C:/asdf#\\%ef\\%bf\\%bd" - }, - { - "id": "19", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:///home/me", - "expect_rel": "file:///home/me" - }, - { - "id": "20", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:c:\\\\foo\\\\bar.html", - "expect_rel": "file:///c:/foo/bar.html" - }, - { - "id": "21", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file:c|//foo\\\\bar.html", - "expect_rel": "file:///c%7C//foo/bar.html" - }, - { - "id": "22", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "//", - "expect_rel": "file:///" - }, - { - "id": "23", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "///", - "expect_rel": "file:///" - }, - { - "id": "24", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "///test", - "expect_rel": "file:///test" - }, - { - "id": "25", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file://test", - "expect_rel": "file://test/" - }, - { - "id": "26", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file://localhost/", - "expect_rel": "file://localhost/" - }, - { - "id": "27", - "name": "", - "base": "file:///tmp/mock/path", - "rel": "file://localhost/test", - "expect_rel": "file://localhost/test" - } - ] - }, - { - "name": "host", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/host.js", - "desc": "Test cases from Webkit's fast/url/host.js", - "test": [ - { - "id": "1", - "name": "A pathless URL", - "url": "http://google.com", - "expect_url": "http://google.com/" - }, - { - "id": "2", - "name": "", - "url": "http://GoOgLe.CoM/", - "expect_url": "http://google.com/" - }, - { - "id": "3", - "name": "", - "url": "http://Goo%20 goo%7C|.com/", - "expect_url": "http://goo%20%20goo%7C%7C.com/" - }, - { - "id": "4", - "name": "", - "url": "http://GOO\u00a0\u3000goo.com/", - "expect_url": "http://goo%20%20goo.com/" - }, - { - "id": "5", - "name": "", - "url": "http://GOO\u200b\u2060\ufeffgoo.com/", - "expect_url": "http://googoo.com/" - }, - { - "id": "6", - "name": "", - "url": "http://www.foo\u3002bar.com/", - "expect_url": "http://www.foo.bar.com/" - }, - { - "id": "7", - "name": "", - "url": "http://\ufdd0zyx.com/", - "expect_url": "http://%EF%BF%BDzyx.com/" - }, - { - "id": "8", - "name": "", - "url": "http://%ef%b7%90zyx.com/", - "expect_url": "http://%EF%BF%BDzyx.com/" - }, - { - "id": "9", - "name": "", - "url": "http://\uff27\uff4f.com/", - "expect_url": "http://go.com/" - }, - { - "id": "10", - "name": "", - "url": "http://\uff05\uff14\uff11.com/", - "expect_url": "http://a.com/" - }, - { - "id": "11", - "name": "", - "url": "http://%ef%bc%85%ef%bc%94%ef%bc%91.com/", - "expect_url": "http://a.com/" - }, - { - "id": "12", - "name": "", - "url": "http://\uff05\uff10\uff10.com/", - "expect_url": "http://%00.com/" - }, - { - "id": "13", - "name": "", - "url": "http://%ef%bc%85%ef%bc%90%ef%bc%90.com/", - "expect_url": "http://%00.com/" - }, - { - "id": "14", - "name": "", - "url": "http://\u4f60\u597d\u4f60\u597d/", - "expect_url": "http://xn--6qqa088eba/" - }, - { - "id": "15", - "name": "", - "url": "http://%E4%BD%A0%E5%A5%BD\u4f60\u597d/", - "expect_url": "http://xn--6qqa088eba/" - }, - { - "id": "16", - "name": "", - "url": "http://%zz%66%a/", - "expect_url": "http://%25zzf%25a/" - }, - { - "id": "17", - "name": "", - "url": "http://%25/", - "expect_url": "http://%25/" - }, - { - "id": "18", - "name": "", - "url": "http://hello%00/", - "expect_url": "http://hello%00/" - }, - { - "id": "19", - "name": "", - "url": "http://%30%78%63%30%2e%30%32%35%30.01/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "20", - "name": "", - "url": "http://%30%78%63%30%2e%30%32%35%30.01%2e/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "21", - "name": "", - "url": "http://%3g%78%63%30%2e%30%32%35%30%2E.01/", - "expect_url": "http://%253gxc0.0250..01/" - }, - { - "id": "22", - "name": "", - "url": "http://192.168.0.1 hello/", - "expect_url": "http://192.168.0.1%20hello/" - }, - { - "id": "23", - "name": "", - "url": "http://\uff10\uff38\uff43\uff10\uff0e\uff10\uff12\uff15\uff10\uff0e\uff10\uff11/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "24", - "name": "", - "url": "http://192.168.0.257/", - "expect_url": "http://192.168.0.257/" - }, - { - "id": "25", - "name": "", - "url": "http://[google.com.]/", - "expect_url": "http://[google.com]/" - }, - { - "id": "26", - "name": "", - "url": "http://\u0442(", - "expect_url": "http://xn--%28-7ed/" - }, - { - "id": "27", - "name": "", - "url": "http://go\\@ogle.com/", - "expect_url": "http://go@ogle.com/" - }, - { - "id": "28", - "name": "", - "url": "http://go/@ogle.com/", - "expect_url": "http://go@ogle.com/" - }, - { - "id": "29", - "name": "", - "url": "http://www.lookout.net::==80::==443::/", - "expect_url": "http://lookout.net/" - }, - { - "id": "30", - "name": "", - "url": "http://www.lookout.net::80::443/", - "expect_url": "http://lookout.net/" - }, - { - "id": "31", - "name": "", - "url": "http://\\", - "expect_url": "http://\\" - }, - { - "id": "32", - "name": "", - "url": "http://\\\\/", - "expect_url": "http://." - }, - { - "id": "33", - "name": "", - "url": "http://\\./", - "expect_url": "http://." - }, - { - "id": "34", - "name": "", - "url": "http:////:@/", - "expect_url": "http://." - }, - { - "id": "35", - "name": "", - "url": "http://\\google.com/foo", - "expect_url": "http://google.com/foo" - }, - { - "id": "36", - "name": "", - "url": "http://\\\\google.com/foo", - "expect_url": "http://google.com/foo" - }, - { - "id": "37", - "name": "", - "url": "http:////asdf@/", - "expect_url": "http://." - }, - { - "id": "38", - "name": "", - "url": "http:////:81/", - "expect_url": "http://." - }, - { - "id": "39", - "name": "", - "url": "http://://", - "expect_url": "http://." - }, - { - "id": "40", - "name": "", - "url": "http://c:/", - "expect_url": "http://." - }, - { - "id": "41", - "name": "", - "url": "http://xxxx:/", - "expect_url": "http://." - }, - { - "id": "42", - "name": "", - "url": "http://.:./", - "expect_url": "http://." - }, - { - "id": "43", - "name": "", - "url": "http://////@google.com/", - "expect_url": "http://." - }, - { - "id": "44", - "name": "", - "url": "http://@google.com/", - "expect_url": "http://google.com/" - }, - { - "id": "45", - "name": "A URL with a pipe character in the hostname.", - "url": "http://c|/", - "expect_url": "http://c|/" - } - ] - }, - { - "name": "idna2003", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/idna2003.js", - "desc": "Test cases from Webkit's fast/url/idna2003.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://fa\u00DF.de/", - "expect_url": "http://fass.de/" - }, - { - "id": "2", - "name": "", - "url": "http://\u03B2\u03CC\u03BB\u03BF\u03C2.com/", - "expect_url": "http://xn--nxasmq6b.com/" - }, - { - "id": "3", - "name": "", - "url": "http://\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com/", - "expect_url": "http://xn--10cl1a0b.com/" - }, - { - "id": "4", - "name": "", - "url": "http://\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com/", - "expect_url": "http://xn--mgba3gch31f.com/" - }, - { - "id": "5", - "name": "", - "url": "http://www.loo\u0138out.net/", - "expect_url": "http://www.xn--looout-5bb.net/" - }, - { - "id": "6", - "name": "", - "url": "http://\u15EF\u15EF\u15EF.lookout.net/", - "expect_url": "http://xn--1qeaa.lookout.net/" - }, - { - "id": "7", - "name": "", - "url": "http://www.lookout.\u0441\u043E\u043C/", - "expect_url": "http://www.lookout.xn--l1adi/" - }, - { - "id": "8", - "name": "", - "url": "http://www.lookout.net\uFF1A80/", - "expect_url": "http://www.lookout.net:80/" - }, - { - "id": "9", - "name": "", - "url": "http://www\u2025lookout.net/", - "expect_url": "http://www..lookout.net/" - }, - { - "id": "10", - "name": "", - "url": "http://www.lookout\u2027net/", - "expect_url": "http://www.xn--lookoutnet-406e/" - }, - { - "id": "11", - "name": "", - "url": "http://www.loo\u0138out.net/", - "expect_url": "http://www.xn--looout-5bb.net/" - }, - { - "id": "12", - "name": "", - "url": "http://www.lookout.net\u2A7480/", - "expect_url": "http://www.lookout.net::%3D80/" - }, - { - "id": "13", - "name": "", - "url": "http://www\u00A0.lookout.net/", - "expect_url": "http://www%20.lookout.net/" - }, - { - "id": "14", - "name": "", - "url": "http://\u1680lookout.net/", - "expect_url": "http://%E1%9A%80lookout.net/" - }, - { - "id": "15", - "name": "", - "url": "http://\u001Flookout.net/", - "expect_url": "http://%1Flookout.net/" - }, - { - "id": "16", - "name": "", - "url": "http://look\u06DDout.net/", - "expect_url": "http://look%DB%9Dout.net/" - }, - { - "id": "17", - "name": "", - "url": "http://look\u180Eout.net/", - "expect_url": "http://look%E1%A0%8Eout.net/" - }, - { - "id": "18", - "name": "", - "url": "http://look\u2060out.net/", - "expect_url": "http://look%E2%81%A0out.net/" - }, - { - "id": "19", - "name": "", - "url": "http://look\uFEFFout.net/", - "expect_url": "http://look%EF%BB%BFout.net/" - }, - { - "id": "20", - "name": "", - "url": "http://look\uD83F\uDFFEout.net/", - "expect_url": "http://look%F0%9F%BF%BEout.net/" - }, - { - "id": "21", - "name": "", - "url": "http://lookDEADout.net/", - "expect_url": "http://look%ED%BA%ADout.net/" - }, - { - "id": "22", - "name": "", - "url": "http://look\uFFFAout.net/", - "expect_url": "http://look%EF%BF%BAout.net/" - }, - { - "id": "23", - "name": "", - "url": "http://look\u2FF0out.net/", - "expect_url": "http://look%E2%BF%B0out.net/" - }, - { - "id": "24", - "name": "", - "url": "http://look\u0341out.net/", - "expect_url": "http://look%CD%81out.net/" - }, - { - "id": "25", - "name": "", - "url": "http://look\u202Eout.net/", - "expect_url": "http://look%E2%80%AEout.net/" - }, - { - "id": "26", - "name": "", - "url": "http://look\u206Bout.net/", - "expect_url": "http://look%E2%81%ABout.net/" - }, - { - "id": "27", - "name": "", - "url": "http://look\uDB40\uDC01out.net/", - "expect_url": "http://look%F3%A0%80%81out.net/" - }, - { - "id": "28", - "name": "", - "url": "http://look\uDB40\uDC20out.net/", - "expect_url": "http://look%F3%A0%80%A0out.net/" - }, - { - "id": "29", - "name": "", - "url": "http://look\u05BEout.net/", - "expect_url": "http://look%D6%BEout.net/" - } - ] - }, - { - "name": "idna2008", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/idna2008.js", - "desc": "Test cases from Webkit's fast/url/idna2008.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://B\u00FCcher.de/", - "expect_url": "http://xn--bcher-kva.de/" - }, - { - "id": "2", - "name": "", - "url": "http://fa\u00DF.de/", - "expect_url": "http://xn--fa-hia.de/" - }, - { - "id": "3", - "name": "", - "url": "http://\u03B2\u03CC\u03BB\u03BF\u03C2.com/", - "expect_url": "http://xn--nxasmm1c.com/" - }, - { - "id": "4", - "name": "", - "url": "http://\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com/", - "expect_url": "http://xn--10cl1a0b660p.com/" - }, - { - "id": "5", - "name": "", - "url": "http://\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com/", - "expect_url": "http://xn--mgba3gch31f060k.com/" - }, - { - "id": "6", - "name": "", - "url": "http://\u2665.net/", - "expect_url": "http://\uFFFD.net/" - }, - { - "id": "7", - "name": "", - "url": "http://\u0378.net/", - "expect_url": "http://\uFFFD.net/" - }, - { - "id": "8", - "name": "", - "url": "http://\u04C0.com/", - "expect_url": "http://\uFFFD.com/" - }, - { - "id": "9", - "name": "", - "url": "http://\uD87E\uDC68.com/", - "expect_url": "http://\uFFFD.com/" - }, - { - "id": "10", - "name": "", - "url": "http://\u2183.com/", - "expect_url": "http://\uFFFD.com/" - }, - { - "id": "11", - "name": "", - "url": "http://look\u034Fout.net/", - "expect_url": "http://lookout.net/" - }, - { - "id": "12", - "name": "", - "url": "http://gOoGle.com/", - "expect_url": "http://google.com/" - }, - { - "id": "13", - "name": "", - "url": "http://\u09dc.com/", - "expect_url": "http://\u09A1\u09BC.com/" - }, - { - "id": "14", - "name": "", - "url": "http://\u1E9E.com/", - "expect_url": "http://ss.com/" - }, - { - "id": "15", - "name": "", - "url": "http://\u1E9E.foo.com/", - "expect_url": "http://ss.foo.com/" - }, - { - "id": "16", - "name": "", - "url": "http://-foo.bar.com", - "expect_url": "http://" - }, - { - "id": "17", - "name": "", - "url": "http://foo-.bar.com", - "expect_url": "http://" - }, - { - "id": "18", - "name": "", - "url": "http://ab--cd.com", - "expect_url": "http://" - }, - { - "id": "19", - "name": "", - "url": "http://xn--0.com", - "expect_url": "http://" - }, - { - "id": "20", - "name": "", - "url": "http://foo\u0300.bar.com/", - "expect_url": "http://foo%CC%80.bar.com/" - } - ] - }, - { - "name": "ipv4", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/ipv4.js", - "desc": "Test cases from Webkit's fast/url/ipv4.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://./", - "expect_url": "http://" - }, - { - "id": "2", - "name": "", - "url": "http://192.168.0.1/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "3", - "name": "", - "url": "http://0300.0250.00.01/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "4", - "name": "", - "url": "http://0xC0.0Xa8.0x0.0x1/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "5", - "name": "", - "url": "http://192.168.9.com/", - "expect_url": "http://" - }, - { - "id": "6", - "name": "", - "url": "http://19a.168.0.1/", - "expect_url": "http://" - }, - { - "id": "7", - "name": "", - "url": "http://0308.0250.00.01/", - "expect_url": "http://" - }, - { - "id": "8", - "name": "", - "url": "http://0xCG.0xA8.0x0.0x1/", - "expect_url": "http://" - }, - { - "id": "9", - "name": "", - "url": "http://192/", - "expect_url": "http://0.0.0.192/" - }, - { - "id": "10", - "name": "", - "url": "http://0xC0a80001/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "11", - "name": "", - "url": "http://030052000001/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "12", - "name": "", - "url": "http://000030052000001/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "13", - "name": "", - "url": "http://192.168/", - "expect_url": "http://192.0.0.168/" - }, - { - "id": "14", - "name": "", - "url": "http://192.0x00A80001/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "15", - "name": "", - "url": "http://0xc0.052000001/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "16", - "name": "", - "url": "http://192.168.1/", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "17", - "name": "", - "url": "http://192.168.0.0.1/", - "expect_url": "http://" - }, - { - "id": "18", - "name": "", - "url": "http://192.168.0.1./", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "19", - "name": "", - "url": "http://192.168.0.1. hello/", - "expect_url": "http://" - }, - { - "id": "20", - "name": "", - "url": "http://192.168.0.1../", - "expect_url": "http://" - }, - { - "id": "21", - "name": "", - "url": "http://192.168..1/", - "expect_url": "http://" - }, - { - "id": "22", - "name": "", - "url": "http://0x100.0/", - "expect_url": "http://" - }, - { - "id": "23", - "name": "", - "url": "http://0x100.0.0/", - "expect_url": "http://" - }, - { - "id": "24", - "name": "", - "url": "http://0x100.0.0.0/", - "expect_url": "http://" - }, - { - "id": "25", - "name": "", - "url": "http://0.0x100.0.0/", - "expect_url": "http://" - }, - { - "id": "26", - "name": "", - "url": "http://0.0.0x100.0/", - "expect_url": "http://" - }, - { - "id": "27", - "name": "", - "url": "http://0.0.0.0x100/", - "expect_url": "http://" - }, - { - "id": "28", - "name": "", - "url": "http://0.0.0x10000/", - "expect_url": "http://" - }, - { - "id": "29", - "name": "", - "url": "http://0.0x1000000/", - "expect_url": "http://" - }, - { - "id": "30", - "name": "", - "url": "http://0x100000000/", - "expect_url": "http://" - }, - { - "id": "31", - "name": "", - "url": "http://0xFF.0/", - "expect_url": "http://255.0.0.0/", - "expect_rel": "" - }, - { - "id": "32", - "name": "", - "url": "http://0xFF.0.0/", - "expect_url": "http://255.0.0.0/" - }, - { - "id": "33", - "name": "", - "url": "http://0xFF.0.0.0/", - "expect_url": "http://255.0.0.0/" - }, - { - "id": "34", - "name": "", - "url": "http://0.0xFF.0.0/", - "expect_url": "http://0.255.0.0/" - }, - { - "id": "35", - "name": "", - "url": "http://0.0.0xFF.0/", - "expect_url": "http://0.0.255.0/" - }, - { - "id": "36", - "name": "", - "url": "http://0.0.0.0xFF/", - "expect_url": "http://0.0.0.255/" - }, - { - "id": "37", - "name": "", - "url": "http://0.0.0xFFFF/", - "expect_url": "http://0.0.255.255/" - }, - { - "id": "38", - "name": "", - "url": "http://0.0xFFFFFF/", - "expect_url": "http://0.255.255.255/" - }, - { - "id": "39", - "name": "", - "url": "http://0xFFFFFFFF/", - "expect_url": "http://255.255.255.255/" - }, - { - "id": "40", - "name": "", - "url": "http://276.256.0xf1a2.077777/", - "expect_url": "http://" - }, - { - "id": "41", - "name": "", - "url": "http://192.168.0.257/", - "expect_url": "http://" - }, - { - "id": "42", - "name": "", - "url": "http://192.168.0xa20001/", - "expect_url": "http://" - }, - { - "id": "43", - "name": "", - "url": "http://192.015052000001/", - "expect_url": "http://" - }, - { - "id": "44", - "name": "", - "url": "http://0X12C0a80001/", - "expect_url": "http://" - }, - { - "id": "45", - "name": "", - "url": "http://276.1.2/", - "expect_url": "http://" - }, - { - "id": "46", - "name": "", - "url": "http://192.168.0.1 hello/", - "expect_url": "http://" - }, - { - "id": "47", - "name": "", - "url": "http://0000000000000300.0x00000000000000fF.00000000000000001/", - "expect_url": "http://192.255.0.1/" - }, - { - "id": "48", - "name": "", - "url": "http://0000000000000300.0xffffffffFFFFFFFF.3022415481470977/", - "expect_url": "http://" - }, - { - "id": "49", - "name": "", - "url": "http://00000000000000000001/", - "expect_url": "http://0.0.0.1/" - }, - { - "id": "50", - "name": "", - "url": "http://0000000000000000100000000000000001/", - "expect_url": "http://" - }, - { - "id": "51", - "name": "", - "url": "http://0.0.0.000000000000000000z/", - "expect_url": "http://" - }, - { - "id": "52", - "name": "", - "url": "http://0.0.0.100000000000000000z/", - "expect_url": "http://" - }, - { - "id": "53", - "name": "", - "url": "http://0.00.0x.0x0/", - "expect_url": "http://0.0.0.0/" - } - ] - }, - { - "name": "ipv6", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/ipv6.js", - "desc": "Test cases from Webkit's fast/url/ipv6.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://[/", - "expect_url": "http://" - }, - { - "id": "2", - "name": "", - "url": "http://[:/", - "expect_url": "http://" - }, - { - "id": "3", - "name": "", - "url": "http://]/", - "expect_url": "http://" - }, - { - "id": "4", - "name": "", - "url": "http://:]/", - "expect_url": "http://" - }, - { - "id": "5", - "name": "", - "url": "http://[]/", - "expect_url": "http://" - }, - { - "id": "6", - "name": "", - "url": "http://[:]/", - "expect_url": "http://" - }, - { - "id": "7", - "name": "", - "url": "http://2001:db8::1/", - "expect_url": "http://" - }, - { - "id": "8", - "name": "", - "url": "http://[2001:db8::1/", - "expect_url": "http://" - }, - { - "id": "9", - "name": "", - "url": "http://2001:db8::1]/", - "expect_url": "http://" - }, - { - "id": "10", - "name": "", - "url": "http://[::]/", - "expect_url": "http://[::]/" - }, - { - "id": "11", - "name": "", - "url": "http://[::1]/", - "expect_url": "http://[::1]/" - }, - { - "id": "12", - "name": "", - "url": "http://[1::.]/", - "expect_url": "http://[1::.]/" - }, - { - "id": "13", - "name": "", - "url": "http://[::192.168.0.1.]/", - "expect_url": "http://[::c0a8:1.]/" - }, - { - "id": "14", - "name": "", - "url": "http://[::ffff:192.168.0.1.]/", - "expect_url": "http://[::ffff:c0a8:1.]/" - }, - { - "id": "15", - "name": "", - "url": "http://[000:01:02:003:004:5:6:007.]/", - "expect_url": "http://[0:1:2:3:4:5:6:7.]/" - }, - { - "id": "16", - "name": "", - "url": "http://[A:b:c:DE:fF:0:1:aC.]/", - "expect_url": "http://[a:b:c:de:ff:0:1:ac.]/" - }, - { - "id": "17", - "name": "", - "url": "http://[1:0:0:2::3:0.]/", - "expect_url": "http://[1::2:0:0:3:0.]/" - }, - { - "id": "18", - "name": "", - "url": "http://[1::2:0:0:3:0.]/", - "expect_url": "http://[1::2:0:0:3:0.]/" - }, - { - "id": "19", - "name": "", - "url": "http://[::eeee:192.168.0.1.]/", - "expect_url": "http://" - }, - { - "id": "20", - "name": "", - "url": "http://[2001::192.168.0.1.]/", - "expect_url": "http://" - }, - { - "id": "21", - "name": "", - "url": "http://[1:2:192.168.0.1:5:6.]/", - "expect_url": "http://" - }, - { - "id": "22", - "name": "", - "url": "http://[::ffff:192.1.2.]/", - "expect_url": "http://[::ffff:c001:2.]/" - }, - { - "id": "23", - "name": "", - "url": "http://[::ffff:0xC0.0Xa8.0x0.0x1.]/", - "expect_url": "http://[::ffff:c0a8:1.]/" - }, - { - "id": "24", - "name": "", - "url": "http://[0:0::0:0:8.]/", - "expect_url": "http://[::8.]/" - }, - { - "id": "25", - "name": "", - "url": "http://[2001:db8::1.]/", - "expect_url": "http://[2001:db8::1.]/" - }, - { - "id": "26", - "name": "", - "url": "http://[2001::db8::1.]/", - "expect_url": "http://" - }, - { - "id": "27", - "name": "", - "url": "http://[2001:db8:::1.]/", - "expect_url": "http://" - }, - { - "id": "28", - "name": "", - "url": "http://[:::.]/", - "expect_url": "http://" - }, - { - "id": "29", - "name": "", - "url": "http://[2001::.com.]/", - "expect_url": "http://" - }, - { - "id": "30", - "name": "", - "url": "http://[::192.168.0.0.1.]/", - "expect_url": "http://" - }, - { - "id": "31", - "name": "", - "url": "http://[::ffff:192.168.0.0.1.]/", - "expect_url": "http://" - }, - { - "id": "32", - "name": "", - "url": "http://[1:2:3:4:5:6:7:8:9.]/", - "expect_url": "http://" - }, - { - "id": "33", - "name": "", - "url": "http://[0:0:0:0:0:0:0:192.168.0.1.]/", - "expect_url": "http://" - }, - { - "id": "34", - "name": "", - "url": "http://[1:2:3:4:5:6::192.168.0.1.]/", - "expect_url": "http://" - }, - { - "id": "35", - "name": "", - "url": "http://[1:2:3:4:5:6::8.]/", - "expect_url": "http://[1:2:3:4:5:6:0:8.]/" - }, - { - "id": "36", - "name": "", - "url": "http://[1:2:3:4:5:6:7:8:.]/", - "expect_url": "http://" - }, - { - "id": "37", - "name": "", - "url": "http://[1:2:3:4:5:6:192.168.0.1:.]/", - "expect_url": "http://" - }, - { - "id": "38", - "name": "", - "url": "http://[-1:2:3:4:5:6:7:8.]/", - "expect_url": "http://" - }, - { - "id": "39", - "name": "", - "url": "http://[1::%1.]/", - "expect_url": "http://" - }, - { - "id": "40", - "name": "", - "url": "http://[1::%eth0.]/", - "expect_url": "http://" - }, - { - "id": "41", - "name": "", - "url": "http://[1::%.]/", - "expect_url": "http://" - }, - { - "id": "42", - "name": "", - "url": "http://[%.]/", - "expect_url": "http://" - }, - { - "id": "43", - "name": "", - "url": "http://[::%:.]/", - "expect_url": "http://" - }, - { - "id": "44", - "name": "", - "url": "http://[:0:0::0:0:8.]/", - "expect_url": "http://" - }, - { - "id": "45", - "name": "", - "url": "http://[0:0::0:0:8:.]/", - "expect_url": "http://" - }, - { - "id": "46", - "name": "", - "url": "http://[:0:0::0:0:8:.]/", - "expect_url": "http://" - }, - { - "id": "47", - "name": "", - "url": "http://[::192.168..1.]/", - "expect_url": "http://" - }, - { - "id": "48", - "name": "", - "url": "http://[::1 hello.]/", - "expect_url": "http://" - } - ] - }, - { - "name": "mailto", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/mailto.js", - "desc": "Test cases from Webkit's fast/url/mailto.js", - "test": [ - { - "id": "1", - "name": "", - "url": "mailto:addr1", - "expect_url": "mailto:addr1" - }, - { - "id": "2", - "name": "", - "url": "mailto:addr1@foo.com", - "expect_url": "mailto:addr1@foo.com" - }, - { - "id": "3", - "name": "", - "url": "mailto:addr1 \\t ", - "expect_url": "mailto:addr1" - }, - { - "id": "4", - "name": "", - "url": "mailto:addr1?to=jon", - "expect_url": "mailto:addr1?to=jon" - }, - { - "id": "5", - "name": "", - "url": "mailto:addr1,addr2", - "expect_url": "mailto:addr1,addr2" - }, - { - "id": "6", - "name": "", - "url": "mailto:addr1, addr2", - "expect_url": "mailto:addr1, addr2" - }, - { - "id": "7", - "name": "", - "url": "mailto:addr1%2caddr2", - "expect_url": "mailto:addr1%2caddr2" - }, - { - "id": "8", - "name": "", - "url": "mailto:\uD800\uDF00", - "expect_url": "mailto:%F0%90%8C%80" - }, - { - "id": "9", - "name": "", - "url": "mailto:addr1?", - "expect_url": "mailto:addr1?" - } - ] - }, - { - "name": "path-url", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path-url.js", - "desc": "Test cases from Webkit's fast/url/path-url.js", - "test": [ - { - "id": "1", - "name": "", - "url": "javascript:", - "expect_url": "javascript:" - }, - { - "id": "2", - "name": "", - "url": "JavaScript:Foo", - "expect_url": "javascript:Foo" - } - ] - }, - { - "name": "path", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js", - "desc": "Test cases from Webkit's fast/url/path.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://www.example.com/././foo", - "expect_url": "http://www.example.com/foo" - }, - { - "id": "2", - "name": "", - "url": "http://www.example.com/./.foo", - "expect_url": "http://www.example.com/.foo" - }, - { - "id": "3", - "name": "", - "url": "http://www.example.com/foo/.", - "expect_url": "http://www.example.com/foo/" - }, - { - "id": "4", - "name": "", - "url": "http://www.example.com/foo/./", - "expect_url": "http://www.example.com/foo/" - }, - { - "id": "5", - "name": "", - "url": "http://www.example.com/foo/bar/..", - "expect_url": "http://www.example.com/foo/" - }, - { - "id": "6", - "name": "", - "url": "http://www.example.com/foo/bar/../", - "expect_url": "http://www.example.com/foo/" - }, - { - "id": "7", - "name": "", - "url": "http://www.example.com/foo/..bar", - "expect_url": "http://www.example.com/foo/..bar" - }, - { - "id": "8", - "name": "", - "url": "http://www.example.com/foo/bar/../ton", - "expect_url": "http://www.example.com/foo/ton" - }, - { - "id": "9", - "name": "", - "url": "http://www.example.com/foo/bar/../ton/../../a", - "expect_url": "http://www.example.com/a" - }, - { - "id": "10", - "name": "", - "url": "http://www.example.com/foo/../../..", - "expect_url": "http://www.example.com/" - }, - { - "id": "11", - "name": "", - "url": "http://www.example.com/foo/../../../ton", - "expect_url": "http://www.example.com/ton" - }, - { - "id": "12", - "name": "", - "url": "http://www.example.com/foo/%2e", - "expect_url": "http://www.example.com/foo/" - }, - { - "id": "13", - "name": "", - "url": "http://www.example.com/foo/%2e%2", - "expect_url": "http://www.example.com/foo/.%2" - }, - { - "id": "14", - "name": "", - "url": "http://www.example.com/foo/%2e./%2e%2e/.%2e/%2e.bar", - "expect_url": "http://www.example.com/..bar" - }, - { - "id": "15", - "name": "", - "url": "http://www.example.com////../..", - "expect_url": "http://www.example.com//" - }, - { - "id": "16", - "name": "", - "url": "http://www.example.com/foo/bar//../..", - "expect_url": "http://www.example.com/foo/" - }, - { - "id": "17", - "name": "", - "url": "http://www.example.com/foo/bar//..", - "expect_url": "http://www.example.com/foo/bar/" - }, - { - "id": "18", - "name": "", - "url": "http://www.example.com/foo/bar/..", - "expect_url": "http://www.example.com/foo/" - }, - { - "id": "19", - "name": "", - "url": "http://www.example.com/foo", - "expect_url": "http://www.example.com/foo" - }, - { - "id": "20", - "name": "", - "url": "http://www.example.com/%20foo", - "expect_url": "http://www.example.com/%20foo" - }, - { - "id": "21", - "name": "", - "url": "http://www.example.com/foo%", - "expect_url": "http://www.example.com/foo%" - }, - { - "id": "22", - "name": "", - "url": "http://www.example.com/foo%2", - "expect_url": "http://www.example.com/foo%2" - }, - { - "id": "23", - "name": "", - "url": "http://www.example.com/foo%2zbar", - "expect_url": "http://www.example.com/foo%2zbar" - }, - { - "id": "24", - "name": "", - "url": "http://www.example.com/foo%2\u00c2\u00a9zbar", - "expect_url": "http://www.example.com/foo%2%C3%82%C2%A9zbar" - }, - { - "id": "25", - "name": "", - "url": "http://www.example.com/foo%41%7a", - "expect_url": "http://www.example.com/fooAz" - }, - { - "id": "26", - "name": "", - "url": "http://www.example.com/foo\u0009\u0091%91", - "expect_url": "http://www.example.com/foo%09%C2%91%91" - }, - { - "id": "27", - "name": "", - "url": "http://www.example.com/foo%00%51", - "expect_url": "http://www.example.com/foo%00Q" - }, - { - "id": "28", - "name": "", - "url": "http://www.example.com/(%28:%3A%29)", - "expect_url": "http://www.example.com/(%28:%3A%29)" - }, - { - "id": "29", - "name": "", - "url": "http://www.example.com/%3A%3a%3C%3c", - "expect_url": "http://www.example.com/%3A%3a%3C%3c" - }, - { - "id": "30", - "name": "", - "url": "http://www.example.com/foo\\tbar", - "expect_url": "http://www.example.com/foo%09bar" - }, - { - "id": "31", - "name": "", - "url": "http://www.example.com\\\\foo\\\\bar", - "expect_url": "http://www.example.com/foo/bar" - }, - { - "id": "32", - "name": "", - "url": "http://www.example.com/%7Ffp3%3Eju%3Dduvgw%3Dd", - "expect_url": "http://www.example.com/%7Ffp3%3Eju%3Dduvgw%3Dd" - }, - { - "id": "33", - "name": "", - "url": "http://www.example.com/@asdf%40", - "expect_url": "http://www.example.com/@asdf%40" - }, - { - "id": "34", - "name": "", - "url": "http://www.example.com/\u4f60\u597d\u4f60\u597d", - "expect_url": "http://www.example.com/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD" - }, - { - "id": "35", - "name": "", - "url": "http://www.example.com/\ufdd0zyx", - "expect_url": "http://www.example.com/%EF%BF%BDzyx" - }, - { - "id": "36", - "name": "", - "url": "http://www.example.com/\u2025/foo", - "expect_url": "http://www.example.com/%E2%80%A5/foo" - }, - { - "id": "37", - "name": "", - "url": "http://www.example.com/DEAD/foo", - "expect_url": "http://www.example.com/\uFFFD/foo" - }, - { - "id": "38", - "name": "", - "url": "http://www.example.com/\uFEFF/foo", - "expect_url": "http://www.example.com/%EF%BB%BF/foo" - }, - { - "id": "39", - "name": "", - "url": "http://www.example.com/\u202E/foo/\u202D/bar", - "expect_url": "http://www.example.com/%E2%80%AE/foo/%E2%80%AD/bar" - }, - { - "id": "40", - "name": "", - "url": "http://www.example.com\uFF0Ffoo/", - "expect_url": "http://www.example.com/foo/" - } - ] - }, - { - "name": "port", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/port.js", - "desc": "Test cases from Webkit's fast/url/port.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://www.example.com:as df/", - "expect_url": "http://www.example.com:as%20df/" - }, - { - "id": "2", - "name": "", - "url": "http://www.example.com:-2/", - "expect_url": "http://www.example.com:-2/" - }, - { - "id": "3", - "name": "", - "url": "http://www.example.com:80/", - "expect_url": "http://www.example.com/" - }, - { - "id": "4", - "name": "", - "url": "http://www.example.com:8080/", - "expect_url": "http://www.example.com:8080/" - }, - { - "id": "5", - "name": "", - "url": "http://www.example.com:/", - "expect_url": "http://www.example.com/" - }, - { - "id": "6", - "name": "", - "url": "http://www.example.com:\u1369/", - "expect_url": "http://www.example.com:%E1%8D%A9/" - }, - { - "id": "7", - "name": "", - "url": "http://www.example.com:\uD835\uDFD6/", - "expect_url": "http://www.example.com:%F0%9D%9F%96/" - } - ] - }, - { - "name": "query", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/query.js", - "desc": "Test cases from Webkit's fast/url/query.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://www.example.com/?foo=bar", - "expect_url": "http://www.example.com/?foo=bar" - }, - { - "id": "2", - "name": "", - "url": "http://www.example.com/?as?df", - "expect_url": "http://www.example.com/?as?df" - }, - { - "id": "3", - "name": "", - "url": "http://www.example.com/?%02hello%7f bye", - "expect_url": "http://www.example.com/?%02hello%7F%20bye" - }, - { - "id": "4", - "name": "", - "url": "http://www.example.com/?%40%41123", - "expect_url": "http://www.example.com/?%40%41123" - }, - { - "id": "5", - "name": "", - "url": "http://www.example.com/?q=\u4F60\u597D", - "expect_url": "http://www.example.com/?q=%26%2320320%3B%26%2322909%3B" - }, - { - "id": "6", - "name": "", - "url": "http://www.example.com/?q=\ud800\ud800", - "expect_url": "http://www.example.com/?q=%26%2355296%3B%26%2355296%3B" - }, - { - "id": "7", - "name": "", - "url": "http://www.example.com/?q=<asdf>", - "expect_url": "http://www.example.com/?q=%3Casdf%3E" - }, - { - "id": "8", - "name": "", - "url": "http://www.example.com/?q=\"asdf\"", - "expect_url": "http://www.example.com/?q=%22asdf%22" - } - ] - }, - { - "name": "relative-unix", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative-unix.js", - "desc": "Test cases from Webkit's fast/url/relative-unix.js", - "test": [ - { - "id": "1", - "name": "", - "base": "http://host/a", - "rel": "\\\\\\\\Another\\\\path", - "expect_rel": "http://another/path" - }, - { - "id": "2", - "name": "", - "base": "http://host/a", - "rel": "/c:\\\\foo", - "expect_rel": "http://host/c:/foo" - }, - { - "id": "3", - "name": "", - "base": "http://host/a", - "rel": "//c:\\\\foo", - "expect_rel": "http://c/foo" - } - ] - }, - { - "name": "relative-win", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative-win.js", - "desc": "Test cases from Webkit's fast/url/relative-win.js", - "test": [ - { - "id": "1", - "name": "", - "base": "file:///C:/foo", - "rel": "http://host/", - "expect_rel": "http://host/" - }, - { - "id": "2", - "name": "", - "base": "file:///C:/foo", - "rel": "bar", - "expect_rel": "file:///C:/bar" - }, - { - "id": "3", - "name": "", - "base": "file:///C:/foo", - "rel": "../../../bar.html", - "expect_rel": "file:///C:/bar.html" - }, - { - "id": "4", - "name": "", - "base": "file:///C:/foo", - "rel": "/../bar.html", - "expect_rel": "file:///C:/bar.html" - }, - { - "id": "5", - "name": "", - "base": "http://host/a", - "rel": "\\\\\\\\another\\\\path", - "expect_rel": "" - }, - { - "id": "6", - "name": "", - "base": "file:///C:/something", - "rel": "//c:/foo", - "expect_rel": "file:///C:/foo" - }, - { - "id": "7", - "name": "", - "base": "file:///C:/something", - "rel": "//localhost/c:/foo", - "expect_rel": "file:///C:/foo" - }, - { - "id": "8", - "name": "", - "base": "file:///C:/foo", - "rel": "c:", - "expect_rel": "" - }, - { - "id": "9", - "name": "", - "base": "file:///C:/foo", - "rel": "c:/foo", - "expect_rel": "" - }, - { - "id": "10", - "name": "", - "base": "http://host/a", - "rel": "c:\\\\foo", - "expect_rel": "" - }, - { - "id": "11", - "name": "", - "base": "file:///C:/foo", - "rel": "/z:/bar", - "expect_rel": "file:///Z:/bar" - }, - { - "id": "12", - "name": "", - "base": "file:///C:/foo", - "rel": "/bar", - "expect_rel": "file:///C:/bar" - }, - { - "id": "13", - "name": "", - "base": "file://localhost/C:/foo", - "rel": "/bar", - "expect_rel": "file://localhost/C:/bar" - }, - { - "id": "14", - "name": "", - "base": "file:///C:/foo/com/", - "rel": "/bar", - "expect_rel": "file:///C:/bar" - }, - { - "id": "15", - "name": "", - "base": "file:///C:/something", - "rel": "//somehost/path", - "expect_rel": "file://somehost/path" - }, - { - "id": "16", - "name": "", - "base": "file:///C:/something", - "rel": "/\\\\//somehost/path", - "expect_rel": "file://somehost/path" - } - ] - }, - { - "name": "relative", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative.js", - "desc": "Test cases from Webkit's fast/url/relative.js", - "test": [ - { - "id": "1", - "name": "", - "base": "http://host/a", - "rel": "http://another/", - "expect_rel": "http://another/" - }, - { - "id": "2", - "name": "", - "base": "http://host/a", - "rel": "http:////another/", - "expect_rel": "http://another/" - }, - { - "id": "3", - "name": "", - "base": "http://foo/bar", - "rel": "", - "expect_rel": "http://foo/bar" - }, - { - "id": "4", - "name": "", - "base": "http://foo/bar#ref", - "rel": "", - "expect_rel": "http://foo/bar" - }, - { - "id": "5", - "name": "", - "base": "http://foo/bar#", - "rel": "", - "expect_rel": "http://foo/bar" - }, - { - "id": "6", - "name": "", - "base": "http://foo/bar", - "rel": " another ", - "expect_rel": "http://foo/another" - }, - { - "id": "7", - "name": "", - "base": "http://foo/bar", - "rel": " . ", - "expect_rel": "http://foo/" - }, - { - "id": "8", - "name": "", - "base": "http://foo/bar", - "rel": " \\t ", - "expect_rel": "http://foo/bar" - }, - { - "id": "9", - "name": "", - "base": "http://host/a", - "rel": "http:path", - "expect_rel": "http://host/path" - }, - { - "id": "10", - "name": "", - "base": "http://host/a/", - "rel": "http:path", - "expect_rel": "http://host/a/path" - }, - { - "id": "11", - "name": "", - "base": "http://host/a", - "rel": "http:/path", - "expect_rel": "http://host/path" - }, - { - "id": "12", - "name": "", - "base": "http://host/a", - "rel": "HTTP:/path", - "expect_rel": "http://host/path" - }, - { - "id": "13", - "name": "", - "base": "http://host/a", - "rel": "https:host2", - "expect_rel": "https://host2/" - }, - { - "id": "14", - "name": "", - "base": "http://host/a", - "rel": "htto:/host2", - "expect_rel": "htto:/host2" - }, - { - "id": "15", - "name": "", - "base": "http://host/a", - "rel": "/b/c/d", - "expect_rel": "http://host/b/c/d" - }, - { - "id": "16", - "name": "", - "base": "http://host/a", - "rel": "\\\\b\\\\c\\\\d", - "expect_rel": "http://host/b/c/d" - }, - { - "id": "17", - "name": "", - "base": "http://host/a", - "rel": "/b/../c", - "expect_rel": "http://host/c" - }, - { - "id": "18", - "name": "", - "base": "http://host/a?b#c", - "rel": "/b/../c", - "expect_rel": "http://host/c" - }, - { - "id": "19", - "name": "", - "base": "http://host/a", - "rel": "\\\\b/../c?x#y", - "expect_rel": "http://host/c?x#y" - }, - { - "id": "20", - "name": "", - "base": "http://host/a?b#c", - "rel": "/b/../c?x#y", - "expect_rel": "http://host/c?x#y" - }, - { - "id": "21", - "name": "", - "base": "http://host/a", - "rel": "b", - "expect_rel": "http://host/b" - }, - { - "id": "22", - "name": "", - "base": "http://host/a", - "rel": "bc/de", - "expect_rel": "http://host/bc/de" - }, - { - "id": "23", - "name": "", - "base": "http://host/a/", - "rel": "bc/de?query#ref", - "expect_rel": "http://host/a/bc/de?query#ref" - }, - { - "id": "24", - "name": "", - "base": "http://host/a/", - "rel": ".", - "expect_rel": "http://host/a/" - }, - { - "id": "25", - "name": "", - "base": "http://host/a/", - "rel": "..", - "expect_rel": "http://host/" - }, - { - "id": "26", - "name": "", - "base": "http://host/a/", - "rel": "./..", - "expect_rel": "http://host/" - }, - { - "id": "27", - "name": "", - "base": "http://host/a/", - "rel": "../.", - "expect_rel": "http://host/" - }, - { - "id": "28", - "name": "", - "base": "http://host/a/", - "rel": "././.", - "expect_rel": "http://host/a/" - }, - { - "id": "29", - "name": "", - "base": "http://host/a?query#ref", - "rel": "../../../foo", - "expect_rel": "http://host/foo" - }, - { - "id": "30", - "name": "", - "base": "http://host/a", - "rel": "?foo=bar", - "expect_rel": "http://host/a?foo=bar" - }, - { - "id": "31", - "name": "", - "base": "http://host/a?x=y#z", - "rel": "?", - "expect_rel": "http://host/a?" - }, - { - "id": "32", - "name": "", - "base": "http://host/a?x=y#z", - "rel": "?foo=bar#com", - "expect_rel": "http://host/a?foo=bar#com" - }, - { - "id": "33", - "name": "", - "base": "http://host/a", - "rel": "#ref", - "expect_rel": "http://host/a#ref" - }, - { - "id": "34", - "name": "", - "base": "http://host/a#b", - "rel": "#", - "expect_rel": "http://host/a#" - }, - { - "id": "35", - "name": "", - "base": "http://host/a?foo=bar#hello", - "rel": "#bye", - "expect_rel": "http://host/a?foo=bar#bye" - }, - { - "id": "36", - "name": "", - "base": "data:foobar", - "rel": "baz.html", - "expect_rel": "" - }, - { - "id": "37", - "name": "", - "base": "data:foobar", - "rel": "data:baz", - "expect_rel": "data:baz" - }, - { - "id": "38", - "name": "", - "base": "data:foobar", - "rel": "data:/base", - "expect_rel": "data:/base" - }, - { - "id": "39", - "name": "", - "base": "data:foobar", - "rel": "http://host/", - "expect_rel": "http://host/" - }, - { - "id": "40", - "name": "", - "base": "data:foobar", - "rel": "http:host", - "expect_rel": "http://host/" - }, - { - "id": "41", - "name": "", - "base": "http://foo/bar", - "rel": "./asd:fgh", - "expect_rel": "http://foo/asd:fgh" - }, - { - "id": "42", - "name": "", - "base": "http://foo/bar", - "rel": ":foo", - "expect_rel": "http://foo/:foo" - }, - { - "id": "43", - "name": "", - "base": "http://foo/bar", - "rel": " hello world", - "expect_rel": "http://foo/hello%20world" - }, - { - "id": "44", - "name": "", - "base": "data:asdf", - "rel": ":foo", - "expect_rel": "" - }, - { - "id": "45", - "name": "", - "base": "http://host/a", - "rel": ";foo", - "expect_rel": "http://host/;foo" - }, - { - "id": "46", - "name": "", - "base": "http://host/a;", - "rel": ";foo", - "expect_rel": "http://host/;foo" - }, - { - "id": "47", - "name": "", - "base": "http://host/a", - "rel": ";/../bar", - "expect_rel": "http://host/bar" - }, - { - "id": "48", - "name": "", - "base": "http://host/a", - "rel": "//another", - "expect_rel": "http://another/" - }, - { - "id": "49", - "name": "", - "base": "http://host/a", - "rel": "//another/path?query#ref", - "expect_rel": "http://another/path?query#ref" - }, - { - "id": "50", - "name": "", - "base": "http://host/a", - "rel": "///another/path", - "expect_rel": "http://another/path" - }, - { - "id": "51", - "name": "", - "base": "http://host/a", - "rel": "//Another\\\\path", - "expect_rel": "http://another/path" - }, - { - "id": "52", - "name": "", - "base": "http://host/a", - "rel": "//", - "expect_rel": "http:" - }, - { - "id": "53", - "name": "", - "base": "http://host/a", - "rel": "\\\\/another/path", - "expect_rel": "http://another/path" - }, - { - "id": "54", - "name": "", - "base": "http://host/a", - "rel": "/\\\\Another\\\\path", - "expect_rel": "http://another/path" - } - ] - }, - { - "name": "scheme", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/scheme.js", - "desc": "Test cases from Webkit's fast/url/scheme.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://example.com/", - "expect_url": "http://example.com/" - }, - { - "id": "2", - "name": "", - "url": "HTTP://example.com/", - "expect_url": "http://example.com/" - } - ] - }, - { - "name": "segments-from-data-url", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments-from-data-url.js", - "desc": "Test cases from Webkit's fast/url/segments-from-data-url.js", - "test": [ - { - "id": "1", - "name": "", - "rel": "http://user:pass@foo:21/bar;par?b#c", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "21", - "expect_pathname": "/bar;par", - "expect_search": "?b", - "expect_hash": "#c" - }, - { - "id": "2", - "name": "", - "rel": "http:foo.com", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "foo.com", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "3", - "name": "", - "rel": "\u0009 :foo.com \u000A", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "4", - "name": "", - "rel": " foo.com ", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "5", - "name": "", - "rel": "a:\u0009 foo.com", - "base": "data:text/plain,baseURL", - "expect_protocol": "a:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": " foo.com", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "6", - "name": "", - "rel": "http://f:21/ b ? d # e ", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "21", - "expect_pathname": "/%20b%20", - "expect_search": "?%20d%20", - "expect_hash": "# e" - }, - { - "id": "7", - "name": "", - "rel": "http://f:/c", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "8", - "name": "", - "rel": "http://f:0/c", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "0", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "9", - "name": "", - "rel": "http://f:00000000000000/c", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "0", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "10", - "name": "", - "rel": "http://f:00000000000000000000080/c", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "11", - "name": "", - "rel": "http://f:b/c", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "12", - "name": "", - "rel": "http://f: /c", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "13", - "name": "", - "rel": "http://f:\u000A/c", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "14", - "name": "", - "rel": "http://f:fifty-two/c", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "15", - "name": "", - "rel": "http://f:999999/c", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "16", - "name": "", - "rel": "http://f: 21 / b ? d # e ", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "17", - "name": "", - "rel": "", - "base": "data:text/plain,baseURL", - "expect_protocol": "data:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "text/plain,baseURL", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "18", - "name": "", - "rel": " \u0009", - "base": "data:text/plain,baseURL", - "expect_protocol": "data:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "text/plain,baseURL", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "19", - "name": "", - "rel": ":foo.com/", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "20", - "name": "", - "rel": ":foo.com\\\\", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "21", - "name": "", - "rel": ":", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "22", - "name": "", - "rel": ":a", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "23", - "name": "", - "rel": ":/", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "24", - "name": "", - "rel": ":\\\\", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "25", - "name": "", - "rel": ":#", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "26", - "name": "", - "rel": "#", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "27", - "name": "", - "rel": "#/", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "28", - "name": "", - "rel": "#\\\\", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "29", - "name": "", - "rel": "#;?", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "30", - "name": "", - "rel": "?", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "31", - "name": "", - "rel": "/", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "32", - "name": "", - "rel": ":23", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "33", - "name": "", - "rel": "/:23", - "base": "data:text/plain,baseURL", - "expect_protocol": "data:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/:23", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "34", - "name": "", - "rel": "//", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "35", - "name": "", - "rel": "::", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "36", - "name": "", - "rel": "::23", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "37", - "name": "", - "rel": "foo://", - "base": "data:text/plain,baseURL", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "//", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "38", - "name": "", - "rel": "http://a:b@c:29/d", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "c", - "expect_port": "29", - "expect_pathname": "/d", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "39", - "name": "", - "rel": "http::@c:29", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "c", - "expect_port": "29", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "40", - "name": "", - "rel": "http://&a:foo(b]c@d:2/", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "d", - "expect_port": "2", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "41", - "name": "", - "rel": "http://::@c@d:2", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "d", - "expect_port": "2", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "42", - "name": "", - "rel": "http://foo.com:b@d/", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "d", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "43", - "name": "", - "rel": "http://foo.com/\\\\@", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "foo.com", - "expect_port": "", - "expect_pathname": "//@", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "44", - "name": "", - "rel": "http:\\\\\\\\foo.com\\\\", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "foo.com", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "45", - "name": "", - "rel": "http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "a", - "expect_port": "", - "expect_pathname": "/b:c/d@foo.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "46", - "name": "", - "rel": "foo:/", - "base": "data:text/plain,baseURL", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "47", - "name": "", - "rel": "foo:/bar.com/", - "base": "data:text/plain,baseURL", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/bar.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "48", - "name": "", - "rel": "foo://///////", - "base": "data:text/plain,baseURL", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/////////", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "49", - "name": "", - "rel": "foo://///////bar.com/", - "base": "data:text/plain,baseURL", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/////////bar.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "50", - "name": "", - "rel": "foo:////://///", - "base": "data:text/plain,baseURL", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "////://///", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "51", - "name": "", - "rel": "c:/foo", - "base": "data:text/plain,baseURL", - "expect_protocol": "c:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/foo", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "52", - "name": "", - "rel": "//foo/bar", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "53", - "name": "", - "rel": "http://foo/path;a??e#f#g", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "/path;a", - "expect_search": "??e", - "expect_hash": "#f#g" - }, - { - "id": "54", - "name": "", - "rel": "http://foo/abcd?efgh?ijkl", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "/abcd", - "expect_search": "?efgh?ijkl", - "expect_hash": "" - }, - { - "id": "55", - "name": "", - "rel": "http://foo/abcd#foo?bar", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "/abcd", - "expect_search": "", - "expect_hash": "#foo?bar" - }, - { - "id": "56", - "name": "", - "rel": "[61:24:74]:98", - "base": "data:text/plain,baseURL", - "expect_protocol": "data:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "text/[61:24:74]:98", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "57", - "name": "", - "rel": "http://[61:27]:98", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "58", - "name": "", - "rel": "http:[61:27]/:foo", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "59", - "name": "", - "rel": "http://[1::2]:3:4", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "60", - "name": "", - "rel": "http://2001::1", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "61", - "name": "", - "rel": "http://[2001::1", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "62", - "name": "", - "rel": "http://2001::1]", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "63", - "name": "", - "rel": "http://2001::1]:80", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "64", - "name": "", - "rel": "http://[2001::1]", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "[2001::1]", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "65", - "name": "", - "rel": "http://[2001::1]:80", - "base": "data:text/plain,baseURL", - "expect_protocol": "http:", - "expect_hostname": "[2001::1]", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "66", - "name": "", - "rel": "http://[[::]]", - "base": "data:text/plain,baseURL", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - } - ] - }, - { - "name": "segments", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js", - "desc": "Test cases from Webkit's fast/url/segments.js", - "test": [ - { - "id": "1", - "name": "", - "rel": "http://user:pass@foo:21/bar;par?b#c", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "21", - "expect_pathname": "/bar;par", - "expect_search": "?b", - "expect_hash": "#c" - }, - { - "id": "2", - "name": "", - "rel": "http:foo.com", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/foo.com", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "3", - "name": "", - "rel": "\u0009 :foo.com \u000A", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:foo.com", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "4", - "name": "", - "rel": " foo.com ", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/foo.com", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "5", - "name": "", - "rel": "a:\u0009 foo.com", - "base": "http://example.org/foo/bar", - "expect_protocol": "a:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": " foo.com", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "6", - "name": "", - "rel": "http://f:21/ b ? d # e ", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "21", - "expect_pathname": "/%20b%20", - "expect_search": "?%20d%20", - "expect_hash": "# e" - }, - { - "id": "7", - "name": "", - "rel": "http://f:/c", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "8", - "name": "", - "rel": "http://f:0/c", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "0", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "9", - "name": "", - "rel": "http://f:00000000000000/c", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "0", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "10", - "name": "", - "rel": "http://f:00000000000000000000080/c", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "f", - "expect_port": "", - "expect_pathname": "/c", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "11", - "name": "", - "rel": "http://f:b/c", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "12", - "name": "", - "rel": "http://f: /c", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "13", - "name": "", - "rel": "http://f:\u000A/c", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "14", - "name": "", - "rel": "http://f:fifty-two/c", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "15", - "name": "", - "rel": "http://f:999999/c", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "16", - "name": "", - "rel": "http://f: 21 / b ? d # e ", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "17", - "name": "", - "rel": "", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/bar", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "18", - "name": "", - "rel": " \u0009", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/bar", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "19", - "name": "", - "rel": ":foo.com/", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:foo.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "20", - "name": "", - "rel": ":foo.com\\\\", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:foo.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "21", - "name": "", - "rel": ":", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "22", - "name": "", - "rel": ":a", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:a", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "23", - "name": "", - "rel": ":/", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "24", - "name": "", - "rel": ":\\\\", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "25", - "name": "", - "rel": ":#", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "26", - "name": "", - "rel": "#", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/bar", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "27", - "name": "", - "rel": "#/", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/bar", - "expect_search": "", - "expect_hash": "#/" - }, - { - "id": "28", - "name": "", - "rel": "#\\\\", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/bar", - "expect_search": "", - "expect_hash": "#\\\\" - }, - { - "id": "29", - "name": "", - "rel": "#;?", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/bar", - "expect_search": "", - "expect_hash": "#;?" - }, - { - "id": "30", - "name": "", - "rel": "?", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/bar", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "31", - "name": "", - "rel": "/", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "32", - "name": "", - "rel": ":23", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:23", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "33", - "name": "", - "rel": "/:23", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/:23", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "34", - "name": "", - "rel": "//", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "35", - "name": "", - "rel": "::", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/::", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "36", - "name": "", - "rel": "::23", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/::23", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "37", - "name": "", - "rel": "foo://", - "base": "http://example.org/foo/bar", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "//", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "38", - "name": "", - "rel": "http://a:b@c:29/d", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "c", - "expect_port": "29", - "expect_pathname": "/d", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "39", - "name": "", - "rel": "http::@c:29", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/:@c:29", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "40", - "name": "", - "rel": "http://&a:foo(b]c@d:2/", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "d", - "expect_port": "2", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "41", - "name": "", - "rel": "http://::@c@d:2", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "d", - "expect_port": "2", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "42", - "name": "", - "rel": "http://foo.com:b@d/", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "d", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "43", - "name": "", - "rel": "http://foo.com/\\\\@", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "foo.com", - "expect_port": "", - "expect_pathname": "//@", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "44", - "name": "", - "rel": "http:\\\\\\\\foo.com\\\\", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "foo.com", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "45", - "name": "", - "rel": "http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "a", - "expect_port": "", - "expect_pathname": "/b:c/d@foo.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "46", - "name": "", - "rel": "foo:/", - "base": "http://example.org/foo/bar", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "47", - "name": "", - "rel": "foo:/bar.com/", - "base": "http://example.org/foo/bar", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/bar.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "48", - "name": "", - "rel": "foo://///////", - "base": "http://example.org/foo/bar", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/////////", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "49", - "name": "", - "rel": "foo://///////bar.com/", - "base": "http://example.org/foo/bar", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/////////bar.com/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "50", - "name": "", - "rel": "foo:////://///", - "base": "http://example.org/foo/bar", - "expect_protocol": "foo:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "////://///", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "51", - "name": "", - "rel": "c:/foo", - "base": "http://example.org/foo/bar", - "expect_protocol": "c:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/foo", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "52", - "name": "", - "rel": "//foo/bar", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "/bar", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "53", - "name": "", - "rel": "http://foo/path;a??e#f#g", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "/path;a", - "expect_search": "??e", - "expect_hash": "#f#g" - }, - { - "id": "54", - "name": "", - "rel": "http://foo/abcd?efgh?ijkl", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "/abcd", - "expect_search": "?efgh?ijkl", - "expect_hash": "" - }, - { - "id": "55", - "name": "", - "rel": "http://foo/abcd#foo?bar", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "/abcd", - "expect_search": "", - "expect_hash": "#foo?bar" - }, - { - "id": "56", - "name": "", - "rel": "[61:24:74]:98", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/[61:24:74]:98", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "57", - "name": "", - "rel": "http://[61:27]:98", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "58", - "name": "", - "rel": "http:[61:27]/:foo", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.org", - "expect_port": "", - "expect_pathname": "/foo/[61:27]/:foo", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "59", - "name": "", - "rel": "http://[1::2]:3:4", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "60", - "name": "", - "rel": "http://2001::1", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "61", - "name": "", - "rel": "http://[2001::1", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "62", - "name": "", - "rel": "http://2001::1]", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "63", - "name": "", - "rel": "http://2001::1]:80", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "64", - "name": "", - "rel": "http://[2001::1]", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "[2001::1]", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "65", - "name": "", - "rel": "http://[2001::1]:80", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "[2001::1]", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "66", - "name": "", - "rel": "http://[[::]]", - "base": "http://example.org/foo/bar", - "expect_protocol": ":", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "", - "expect_search": "", - "expect_hash": "" - } - ] - }, - { - "name": "standard-url", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/standard-url.js", - "desc": "Test cases from Webkit's fast/url/standard-url.js", - "test": [ - { - "id": "1", - "name": "", - "url": "http://www.google.com/foo?bar=baz#", - "expect_url": "http://www.google.com/foo?bar=baz#" - }, - { - "id": "2", - "name": "", - "url": "http://[www.google.com]/", - "expect_url": "http://[www.google.com]/" - }, - { - "id": "3", - "name": "", - "url": "http:////////user:@google.com:99?foo", - "expect_url": "http://user@google.com:99/?foo" - }, - { - "id": "4", - "name": "", - "url": "http://192.0x00A80001", - "expect_url": "http://192.168.0.1/" - }, - { - "id": "5", - "name": "", - "url": "http://www/foo%2Ehtml", - "expect_url": "http://www/foo.html" - }, - { - "id": "6", - "name": "", - "url": "http://user:pass@/", - "expect_url": "http://user:pass@/" - }, - { - "id": "7", - "name": "", - "url": "http://%25DOMAIN:foobar@foodomain.com/", - "expect_url": "http://%25DOMAIN:foobar@foodomain.com/" - }, - { - "id": "8", - "name": "", - "url": "http:\\\\\\\\www.google.com\\\\foo", - "expect_url": "http://www.google.com/foo" - }, - { - "id": "9", - "name": "", - "url": "http://www.google.com/asdf#\uFFFD", - "expect_url": "http://www.google.com/asdf#\uFFFD" - }, - { - "id": "10", - "name": "", - "url": "http://foo:80/", - "expect_url": "http://foo/" - }, - { - "id": "11", - "name": "", - "url": "http://foo:81/", - "expect_url": "http://foo:81/" - }, - { - "id": "12", - "name": "", - "url": "httpa://foo:80/", - "expect_url": "httpa://foo:80/" - }, - { - "id": "13", - "name": "", - "url": "http://foo:-80/", - "expect_url": "http://foo:-80/" - }, - { - "id": "14", - "name": "", - "url": "https://foo:443/", - "expect_url": "https://foo/" - }, - { - "id": "15", - "name": "", - "url": "https://foo:80/", - "expect_url": "https://foo:80/" - }, - { - "id": "16", - "name": "", - "url": "ftp://foo:21/", - "expect_url": "ftp://foo/" - }, - { - "id": "17", - "name": "", - "url": "ftp://foo:80/", - "expect_url": "ftp://foo:80/" - }, - { - "id": "18", - "name": "", - "url": "gopher://foo:70/", - "expect_url": "gopher://foo/" - }, - { - "id": "19", - "name": "", - "url": "gopher://foo:443/", - "expect_url": "gopher://foo:443/" - }, - { - "id": "20", - "name": "", - "url": "ws://foo:80/", - "expect_url": "ws://foo/" - }, - { - "id": "21", - "name": "", - "url": "ws://foo:81/", - "expect_url": "ws://foo:81/" - }, - { - "id": "22", - "name": "", - "url": "ws://foo:443/", - "expect_url": "ws://foo:443/" - }, - { - "id": "23", - "name": "", - "url": "ws://foo:815/", - "expect_url": "ws://foo:815/" - }, - { - "id": "24", - "name": "", - "url": "wss://foo:80/", - "expect_url": "wss://foo:80/" - }, - { - "id": "25", - "name": "", - "url": "wss://foo:81/", - "expect_url": "wss://foo:81/" - }, - { - "id": "26", - "name": "", - "url": "wss://foo:443/", - "expect_url": "wss://foo/" - }, - { - "id": "27", - "name": "", - "url": "wss://foo:815/", - "expect_url": "wss://foo:815/" - } - ] - }, - { - "name": "trivial-segments", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/trivial-segments.js", - "desc": "Test cases from Webkit's fast/url/trivial-segments.js", - "test": [ { - "id": "1", - "name": "", - "rel": "http://example.com/", - "base": "http://example.org/foo/bar", - "expect_protocol": "http:", - "expect_hostname": "example.com", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - } ] - }, - { - "name": "trivial", - "link": "http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/trivial.js", - "desc": "Test cases from Webkit's fast/url/trivial.js", - "test": [ - { - "id": "1", - "name": "", - "base": "http://example.org/foo/bar", - "rel": "http://example.com/", - "expect_rel": "http://example.com/" - }, - { - "id": "2", - "name": "", - "base": "http://example.org/foo/bar", - "rel": "/", - "expect_rel": "http://example.org/" - } - ] - }, - { - "name": "normalization", - "link": "#", - "desc": "Test cases for normalization behaviors - see http://www.unicode.org/reports/tr15/ Figure 6 and RFC3987", - "test": [ - { - "id": "1", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "résumé/résumé.html", - "expect_rel": "résumé/résumé.html" - }, - { - "id": "2", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "résumé.html", - "expect_rel": "résumé.html" - }, - { - "id": "3", - "name": "", - "charset": "windows-1258", - "base": "http://www.example.com/", - "rel": "ViệtNam.html", - "expect_rel": "ViệtNam.html" - }, - { - "id": "4", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "\uFB01?\uFB01#\uFB01", - "expect_rel": "\uFB01?\uFB01#\uFB01" - }, - { - "id": "5", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "?résumé#résumé", - "expect_rel": "?résumé#résumé" - }, - { - "id": "6", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "2\u2075?2\u2075#2\u2075", - "expect_rel": "2\u2075?2\u2075#2\u2075" - }, - { - "id": "7", - "name": "", - "charset": "windows-1258", - "base": "http://www.example.com/", - "rel": "?ViệtNam#ViệtNam", - "expect_rel": "?ViệtNam#ViệtNam" - }, - { - "id": "8", - "name": "", - "charset": "windows-1258", - "base": "http://www.example.com/", - "rel": "foo?q=\u2665", - "expect_rel": "foo?q=\u2665" - }, - { - "id": "9", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "\u1E9B\u0323/?\u1E9B\u0323#\u1E9B\u0323", - "expect_rel": "\u1E9B\u0323/?\u1E9B\u0323#\u1E9B\u0323" - }, - { - "id": "10", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "\u212B/?\u212B#\u212B", - "expect_rel": "\u1E9B\u0323/?\u1E9B\u0323#\u1E9B\u0323" - }, - { - "id": "11", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "\u1E9B\u0323/?\u1E9B\u0323#\u1E9B\u0323", - "expect_rel": "\u1E9B\u0323/?\u1E9B\u0323#\u1E9B\u0323" - }, - { - "id": "12", - "name": "", - "charset": "utf-8", - "base": "http://www.example.com/", - "rel": "\u1E0B\u0323/?\u1E0B\u0323#\u1E0B\u0323", - "expect_rel": "\u1E0B\u0323/?\u1E0B\u0323#\u1E0B\u0323" - } - ] - }, - { - "name": "whitespace", - "link": "#", - "desc": "Various references with white space", - "test": [ - { - "id": "1", - "name": "", - "url": "http://www.example.com/foo bar/? foo = bar # foo", - "expect_url": "http://www.example.com/foo bar/? foo = bar # foo" - }, - { - "id": "2", - "name": "", - "url": "http://www.example.com/ ", - "expect_url": "http://www.example.com/ " - } - ] - }, - { - "name": "percent-encoding", - "link": "#", - "desc": "Test how percent-encoding is handled", - "test": [ - { - "id": "1", - "name": "Test if delimeters such as \"?\" are unencoded", - "charset": "utf-8", - "url": "http://www.example.com/foo%3fbar", - "expect_url": "http://www.example.com/foo?bar" - }, - { - "id": "2", - "name": "Test if delimeters such as \"/\" are unencoded", - "charset": "utf-8", - "url": "http://www.example.com/foo%2fbar", - "expect_url": "http://www.example.com/foo/bar" - }, - { - "id": "3", - "name": "Test if entire string is unencoded", - "charset": "utf-8", - "url": "%68%74%74%70%3a%2f%2f%77%77%77%2e%65%78%61%6d%70%6c%65%2e%63%6f%6d%2f", - "expect_url": "http://www.example.com/" - }, - { - "id": "4", - "name": "Test if scheme gets unencoded", - "charset": "utf-8", - "url": "http%3a%2f%2f%77%77%77%2e%65%78%61%6d%70%6c%65%2e%63%6f%6d%2f", - "expect_url": "http://www.example.com/" - }, - { - "id": "5", - "name": "Test if authority and port gets unencoded", - "charset": "utf-8", - "url": "http://%77%77%77%2e%65%78%61%6d%70%6c%65%2e%63%6f%6d%3a%38%30", - "expect_url": "http://www.example.com:80/" - }, - { - "id": "6", - "name": "", - "charset": "iso-8859-1", - "url": "http://%A1%C1.com", - "expect_url": "http://¡À.com" - }, - { - "id": "7", - "name": "Test mixed encodings", - "charset": "iso-8859-1", - "url": "http://www.example.com/%A1%C1/?foo=%EF%BD%81", - "expect_url": "http://www.example.com/%A1%C1/?foo=%EF%BD%81" - }, - { - "id": "8", - "name": "Test mixed encodings", - "charset": "iso-8859-1", - "url": "http://www.example.com/%EF%BD%81/?foo=%A1%C1", - "expect_url": "http://www.example.com/%EF%BD%81/?foo=%A1%C1", - "comment": "." - }, - { - "id": "9", - "name": "Test mixed encodings", - "charset": "iso-8859-1", - "url": "http://www.example.com/FOO/?foo=%A1%C1", - "expect_url": "http://www.example.com/FOO/?foo=%A1%C1" - }, - { - "id": "10", - "name": "Test mixed encodings", - "charset": "iso-8859-1", - "url": "http://www.example.com/%A1%C1/?foo=FOO", - "expect_url": "http://www.example.com/%A1%C1/?foo=FOO" - }, - { - "id": "11", - "name": "Test mixed encodings", - "charset": "utf-8", - "url": "http://www.example.com/FOO/?foo=%A1%C1", - "expect_url": "http://www.example.com/FOO/?foo=%A1%C1" - }, - { - "id": "12", - "name": "The Martin Dürst test", - "charset": "iso-8859-1", - "url": "http://www.example.com/D%FCrst", - "expect_url": "http://www.example.com/D%FCrst" - }, - { - "id": "13", - "name": "The Martin Dürst test", - "charset": "iso-8859-1", - "url": "http://www.example.com/D%C3%BCrst", - "expect_url": "http://www.example.com/D%C3%BCrst" - }, - { - "id": "14", - "name": "The Martin Dürst test", - "charset": "iso-8859-1", - "url": "http://www.example.com/?D%FCrst", - "expect_url": "http://www.example.com/?D%FCrst" - }, - { - "id": "15", - "name": "The Martin Dürst test", - "charset": "iso-8859-1", - "url": "http://www.example.com/?D%C3%BCrst", - "expect_url": "http://www.example.com/?D%C3%BCrst" - } - ] - }, - { - "name": "miscellaneous", - "link": "#", - "desc": "Misc test cases", - "test": [ - { - "id": "1", - "name": "", - "url": "http://user%40example.com/", - "expect_url": "http://user@example.com/", - "expect_protocol": "http:", - "expect_hostname": "example.com", - "expect_port": "80", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "2", - "name": "", - "url": "http://user%3Ainfo%40/", - "expect_url": "http://user:info@/", - "expect_protocol": "http:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "3", - "name": "", - "url": "http://user@/", - "expect_url": "http://user@/", - "expect_protocol": "http:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "/", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "4", - "name": "", - "url": "$:foo/bar", - "expect_url": "$:", - "expect_protocol": "$:", - "expect_hostname": "foo", - "expect_port": "", - "expect_pathname": "bar", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "5", - "name": "Two colons after mailto scheme", - "url": "mailto::foo@bar.com", - "expect_url": "mailto::foo@bar.com", - "expect_protocol": "mailto:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": ":foo@bar.com", - "expect_search": "", - "expect_hash": "" - } - ] - }, - { - "name": "data-scheme", - "link": "#", - "desc": "Test cases using the data scheme", - "test": [ - { - "id": "1", - "name": "A good test that should pass.", - "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_protocol": "data:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "2", - "name": "A test using two colons after scheme", - "url": "data::image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_url": "data::image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_protocol": "data:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": ":image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_search": "", - "expect_hash": "" - }, - { - "id": "3", - "name": "A test using three colons after scheme", - "url": "data:::image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_url": "data:::image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_protocol": "data:", - "expect_hostname": "", - "expect_port": "", - "expect_pathname": "::image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC", - "expect_search": "", - "expect_hash": "" - } - ] - } - ] - } -} diff --git a/test/runtests.jl b/test/runtests.jl index a4cf2bfdb..cd8aa1355 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,8 +11,6 @@ include("resources/TestRequest.jl") "multipart.jl", "parsemultipart.jl", "sniff.jl", - "uri.jl", - "url.jl", "cookies.jl", "parser.jl", "loopback.jl", diff --git a/test/uri.jl b/test/uri.jl deleted file mode 100644 index f463bca3e..000000000 --- a/test/uri.jl +++ /dev/null @@ -1,516 +0,0 @@ -using Test -using HTTP -using HTTP.URIs - -mutable struct URLTest - name::String - url::String - isconnect::Bool - expecteduri::HTTP.URI - shouldthrow::Bool -end - -struct Offset - off::UInt16 - len::UInt16 -end - -function parse_connect_target(target) - t = parse(HTTP.URI, "dummy://$target") - if !isempty(t.userinfo) || - !isempty(t.path) || - isempty(t.host) || - isempty(t.port) - - throw(HTTP.URIs.ParseError("")) - end - return t.host, t.port -end - -function offset_uri(uri, offset) - if offset == Offset(0,0) - return SubString(uri, 1, 0) - else - return SubString(uri, offset.off, offset.off + offset.len-1) - end -end - -function URLTest(nm::String, url::String, isconnect::Bool, shouldthrow::Bool) - URLTest(nm, url, isconnect, HTTP.URI(""), shouldthrow) -end - -function URLTest(nm::String, url::String, isconnect::Bool, offsets::NTuple{7, Offset}, shouldthrow::Bool) - uri = HTTP.URI(url, (offset_uri(url, o) for o in offsets)...) - URLTest(nm, url, isconnect, uri, shouldthrow) -end - -urls = [("hdfs://user:password@hdfshost:9000/root/folder/file.csv#frag", ["root", "folder", "file.csv"]), - ("https://user:password@httphost:9000/path1/path2;paramstring?q=a&p=r#frag", ["path1", "path2;paramstring"]), - ("https://user:password@httphost:9000/path1/path2?q=a&p=r#frag", ["path1","path2"]), - ("https://user:password@httphost:9000/path1/path2;paramstring#frag", ["path1","path2;paramstring"]), - ("https://user:password@httphost:9000/path1/path2#frag", ["path1","path2"]), - ("file:///path/to/file/with%3fshould%3dwork%23fine", ["path","to","file","with%3fshould%3dwork%23fine"]), - ("ftp://ftp.is.co.za/rfc/rfc1808.txt", ["rfc","rfc1808.txt"]), - ("http://www.ietf.org/rfc/rfc2396.txt", ["rfc","rfc2396.txt"]), - ("ldap://[2001:db8::7]/c=GB?objectClass?one", ["c=GB"]), - ("mailto:John.Doe@example.com", ["John.Doe@example.com"]), - ("news:comp.infosystems.www.servers.unix", ["comp.infosystems.www.servers.unix"]), - ("tel:+1-816-555-1212", ["+1-816-555-1212"]), - ("telnet://192.0.2.16:80/", String[]), - ("urn:oasis:names:specification:docbook:dtd:xml:4.1.2", ["oasis:names:specification:docbook:dtd:xml:4.1.2"]) - ] - -urltests = URLTest[ - URLTest("proxy request" - ,"http://hostname/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(8, 8) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(16, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("proxy request with port" - ,"http://hostname:444/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(8, 8) # UF_HOST - ,Offset(17, 3) # UF_PORT - ,Offset(20, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("CONNECT request" - ,"hostname:443" - ,true - ,(Offset(0, 0) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(1, 8) # UF_HOST - ,Offset(10, 3) # UF_PORT - ,Offset(0, 0) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("proxy ipv6 request" - ,"http://[1:2::3:4]/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(9, 8) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(18, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("proxy ipv6 request with port" - ,"http://[1:2::3:4]:67/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(9, 8) # UF_HOST - ,Offset(19, 2) # UF_PORT - ,Offset(21, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("CONNECT ipv6 address" - ,"[1:2::3:4]:443" - ,true - ,(Offset(0, 0) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(2, 8) # UF_HOST - ,Offset(12, 3) # UF_PORT - ,Offset(0, 0) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("ipv4 in ipv6 address" - ,"http://[2001:0000:0000:0000:0000:0000:1.9.1.1]/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(9,37) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(47, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("extra ? in query string" - ,"http://a.tbcdn.cn/p/fp/2010c/??fp-header-min.css,fp-base-min.css,fp-channel-min.css,fp-product-min.css,fp-mall-min.css,fp-category-min.css,fp-sub-min.css,fp-gdp4p-min.css,fp-css3-min.css,fp-misc-min.css?t=20101022.css" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(8,10) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(18,12) # UF_PATH - ,Offset(31,187) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("space URL encoded" - ,"/toto.html?toto=a%20b" - ,false - ,(Offset(0, 0) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(0, 0) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(1,10) # UF_PATH - ,Offset(12,10) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("URL fragment" - ,"/toto.html#titi" - ,false - ,(Offset(0, 0) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(0, 0) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(1,10) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(12, 4) # UF_FRAGMENT - ) - ,false - ), URLTest("complex URL fragment" - ,"http://www.webmasterworld.com/r.cgi?f=21&d=8405&url=http://www.example.com/index.html?foo=bar&hello=world#midpage" - ,false - ,(Offset( 1, 4) # UF_SCHEMA - ,Offset( 0, 0) # UF_USERINFO - ,Offset( 8, 22) # UF_HOST - ,Offset( 0, 0) # UF_PORT - ,Offset( 30, 6) # UF_PATH - ,Offset( 37, 69) # UF_QUERY - ,Offset(107, 7) # UF_FRAGMENT - ) - ,false - ), URLTest("complex URL from node js url parser doc" - ,"http://host.com:8080/p/a/t/h?query=string#hash" - ,false - ,( Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(8, 8) # UF_HOST - ,Offset(17, 4) # UF_PORT - ,Offset(21, 8) # UF_PATH - ,Offset(30,12) # UF_QUERY - ,Offset(43, 4) # UF_FRAGMENT - ) - ,false - ), URLTest("complex URL with basic auth from node js url parser doc" - ,"http://a:b@host.com:8080/p/a/t/h?query=string#hash" - ,false - ,( Offset(1, 4) # UF_SCHEMA - ,Offset(8, 3) # UF_USERINFO - ,Offset(12, 8) # UF_HOST - ,Offset(21, 4) # UF_PORT - ,Offset(25, 8) # UF_PATH - ,Offset(34,12) # UF_QUERY - ,Offset(47, 4) # UF_FRAGMENT - ) - ,false - ), URLTest("double @" - ,"http://a:b@@hostname:443/" - ,false - ,true - ), URLTest("proxy empty host" - ,"http://:443/" - ,false - ,true - ), URLTest("proxy empty port" - ,"http://hostname:/" - ,false - ,true - ), URLTest("CONNECT with basic auth" - ,"a:b@hostname:443" - ,true - ,true - ), URLTest("CONNECT empty host" - ,":443" - ,true - ,true - ), URLTest("CONNECT empty port" - ,"hostname:" - ,true - ,true - ), URLTest("CONNECT with extra bits" - ,"hostname:443/" - ,true - ,true - ), URLTest("space in URL" - ,"/foo bar/" - ,false - ,true # s_dead - ), URLTest("proxy basic auth with space url encoded" - ,"http://a%20:b@host.com/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(8, 6) # UF_USERINFO - ,Offset(15, 8) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(23, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("carriage return in URL" - ,"/foo\rbar/" - ,false - ,true # s_dead - ), URLTest("proxy double : in URL" - ,"http://hostname::443/" - ,false - ,true # s_dead - ), URLTest("proxy basic auth with double :" - ,"http://a::b@host.com/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(8, 4) # UF_USERINFO - ,Offset(13, 8) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(21, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("line feed in URL" - ,"/foo\nbar/" - ,false - ,true # s_dead - ), URLTest("proxy empty basic auth" - ,"http://@hostname/fo" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(9, 8) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(17, 3) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("proxy line feed in hostname" - ,"http://host\name/fo" - ,false - ,true # s_dead - ), URLTest("proxy % in hostname" - ,"http://host%name/fo" - ,false - ,true # s_dead - ), URLTest("proxy ; in hostname" - ,"http://host;ame/fo" - ,false - ,true # s_dead - ), URLTest("proxy basic auth with unreservedchars" - ,"http://a!;-_!=+\$@host.com/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(8, 9) # UF_USERINFO - ,Offset(18, 8) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(26, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("proxy only empty basic auth" - ,"http://@/fo" - ,false - ,true # s_dead - ), URLTest("proxy only basic auth" - ,"http://toto@/fo" - ,false - ,true # s_dead - ), URLTest("proxy = in URL" - ,"http://host=ame/fo" - ,false - ,true # s_dead - ), URLTest("ipv6 address with Zone ID" - ,"http://[fe80::a%25eth0]/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(9,14) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(24, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("ipv6 address with Zone ID, but '%' is not percent-encoded" - ,"http://[fe80::a%eth0]/" - ,false - ,(Offset(1, 4) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(9,12) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(22, 1) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("ipv6 address ending with '%'" - ,"http://[fe80::a%]/" - ,false - ,true # s_dead - ), URLTest("ipv6 address with Zone ID including bad character" - ,"http://[fe80::a%\$HOME]/" - ,false - ,true # s_dead - ), URLTest("just ipv6 Zone ID" - ,"http://[%eth0]/" - ,false - ,true # s_dead - ), URLTest("tab in URL" - ,"/foo\tbar/" - ,false - ,(Offset(0, 0) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(0, 0) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(1, 9) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ), URLTest("form feed in URL" - ,"/foo\fbar/" - ,false - ,(Offset(0, 0) # UF_SCHEMA - ,Offset(0, 0) # UF_USERINFO - ,Offset(0, 0) # UF_HOST - ,Offset(0, 0) # UF_PORT - ,Offset(1, 9) # UF_PATH - ,Offset(0, 0) # UF_QUERY - ,Offset(0, 0) # UF_FRAGMENT - ) - ,false - ) -] - -@testset "HTTP.URI" begin - @testset "Constructors" begin - @test string(HTTP.URI("")) == "" - @test HTTP.URI(scheme="http", host="google.com") == HTTP.URI("http://google.com") - @test HTTP.URI(scheme="http", host="google.com", path="/") == HTTP.URI("http://google.com/") - @test HTTP.URI(scheme="http", host="google.com", userinfo="user") == HTTP.URI("http://user@google.com") - @test HTTP.URI(scheme="http", host="google.com", path="/user") == HTTP.URI("http://google.com/user") - @test HTTP.URI(scheme="http", host="google.com", query=Dict("key"=>"value")) == HTTP.URI("http://google.com?key=value") - @test HTTP.URI(scheme="http", host="google.com", query=Dict()) |> string == "http://google.com" - @test HTTP.URI(scheme="http", host="google.com", path="/", fragment="user") == HTTP.URI("http://google.com/#user") - end - - @testset "$url - $splpath" for (url, splpath) in urls - u = parse(HTTP.URI, url) - @test string(u) == url - @test isvalid(u) - @test HTTP.URIs.splitpath(u.path) == splpath - end - - @testset "Parse" begin - @test parse(HTTP.URI, "hdfs://user:password@hdfshost:9000/root/folder/file.csv") == HTTP.URI(host="hdfshost", path="/root/folder/file.csv", scheme="hdfs", port=9000, userinfo="user:password") - @test parse(HTTP.URI, "http://google.com:80/some/path") == HTTP.URI(scheme="http", host="google.com", path="/some/path") - - @test parse(HTTP.URI, "https://user:password@httphost:9000/path1/path2;paramstring?q=a&p=r#frag").userinfo == "user:password" - - @test false == isvalid(parse(HTTP.URI, "file:///path/to/file/with?should=work#fine")) - @test true == isvalid(parse(HTTP.URI, "file:///path/to/file/with%3fshould%3dwork%23fine")) - - @test parse(HTTP.URI, "s3://bucket/key") == HTTP.URI(host="bucket", path="/key", scheme="s3") - - @test sprint(show, parse(HTTP.URI, "http://google.com")) == "HTTP.URI(\"http://google.com\")" - end - - @testset "Characters" begin - @test HTTP.Strings.lower(UInt8('A')) == UInt8('a') - @test HTTP.escapeuri(Char(1)) == "%01" - - @test HTTP.escapeuri(Dict("key1"=>"value1", "key2"=>["value2", "value3"])) == "key2=value2&key2=value3&key1=value1" - - @test HTTP.escapeuri("abcdef αβ 1234-=~!@#\$()_+{}|[]a;") == "abcdef%20%CE%B1%CE%B2%201234-%3D%7E%21%40%23%24%28%29_%2B%7B%7D%7C%5B%5Da%3B" - @test HTTP.unescapeuri(HTTP.escapeuri("abcdef 1234-=~!@#\$()_+{}|[]a;")) == "abcdef 1234-=~!@#\$()_+{}|[]a;" - @test HTTP.unescapeuri(HTTP.escapeuri("👽")) == "👽" - - @test HTTP.escapeuri([("foo", "bar"), (1, 2)]) == "foo=bar&1=2" - @test HTTP.escapeuri(Dict(["foo" => "bar", 1 => 2])) in ("1=2&foo=bar", "foo=bar&1=2") - @test HTTP.escapeuri(["foo" => "bar", 1 => 2]) == "foo=bar&1=2" - end - - @testset "Query Params" begin - @test HTTP.queryparams(HTTP.URI("https://httphost/path1/path2;paramstring?q=a&p=r#frag")) == Dict("q"=>"a","p"=>"r") - @test HTTP.queryparams(HTTP.URI("https://foo.net/?q=a&malformed")) == Dict("q"=>"a","malformed"=>"") - end - - @testset "Parse Errors" begin - # Non-ASCII characters - @test_throws HTTP.URIs.ParseError HTTP.URIs.parse_uri("http://🍕.com", strict=true) - # Unexpected start of URL - @test_throws HTTP.URIs.ParseError HTTP.URIs.parse_uri(".google.com", strict=true) - # Unexpected character after scheme - @test_throws HTTP.URIs.ParseError HTTP.URIs.parse_uri("ht!tp://google.com", strict=true) - end - - @testset "HTTP.parse(HTTP.URI, str) - $u" for u in urltests - if u.isconnect - if u.shouldthrow - @test_throws HTTP.URIs.ParseError parse_connect_target(u.url) - else - h, p = parse_connect_target(u.url) - @test h == u.expecteduri.host - @test p == u.expecteduri.port - end - elseif u.shouldthrow - @test_throws HTTP.URIs.ParseError HTTP.URIs.parse_uri_reference(u.url, strict=true) - else - url = parse(HTTP.URI, u.url) - @test u.expecteduri == url - end - end - - @testset "Issue Specific" begin - # Issue #27 - @test HTTP.escapeuri("t est\n") == "t%20est%0A" - - # Issue 323 - @test string(HTTP.URI(scheme="http", host="example.com")) == "http://example.com" - - # Issue 475 - @test HTTP.queryparams(HTTP.URI("http://www.example.com/path/foo+bar/path?query+name=query+value")) == - Dict("query name" => "query value") - @test HTTP.queryparams(HTTP.escapeuri(Dict("a+b" => "c d+e"))) == Dict("a+b" => "c d+e") - - # Issue 540 - @test HTTP.escapeuri((a=1, b=2)) == "a=1&b=2" - end - - @testset "Normalize URI paths" begin - # Examples given in https://tools.ietf.org/html/rfc3986#section-5.2.4 - @test URIs.normpath("/a/b/c/./../../g") == "/a/g" - @test URIs.normpath("mid/content=5/../6") == "mid/6" - - checknp = (x, y)->(@test URIs.normpath(URI(x)) == URI(y)) - - # "Abnormal" examples in https://tools.ietf.org/html/rfc3986#section-5.4.2 - checknp("http://a/b/c/d/../../../g", "http://a/g") - checknp("http://a/b/c/d/../../../../g", "http://a/g") - - # "Normal" examples - checknp("http://a", "http://a") - checknp("http://a/b/c/.", "http://a/b/c/") - checknp("http://a/b/c/./", "http://a/b/c/") - checknp("http://a/b/c/..", "http://a/b/") - checknp("http://a/b/c/../", "http://a/b/") - checknp("http://a/b/c/../g", "http://a/b/g") - checknp("http://a/b/c/../..", "http://a/") - checknp("http://a/b/c/../../", "http://a/") - checknp("http://a/b/c/../../g", "http://a/g") - end -end diff --git a/test/url.jl b/test/url.jl deleted file mode 100644 index 73ad4e946..000000000 --- a/test/url.jl +++ /dev/null @@ -1,39 +0,0 @@ -using JSON -using HTTP -using Test - -@testset "HTTP.URL" begin - tests = JSON.parse(String(read("resources/cweb-urls.json")))["tests"]["group"] - - @testset " - $test - $group" for group in tests, test in group["test"] - name = group["name"] - - url = get(test, "url", nothing) - - if url !== nothing - uri = nothing - - try - uri = HTTP.URIs.parse_uri_reference(url; strict=true) - catch e - if e isa HTTP.URIs.ParseError || e isa AssertionError - continue - else - rethrow(e) - end - end - - if haskey(test, "expect_protocol") - @test uri.scheme == test["expect_protocol"][1:end-1] - end - - if haskey(test, "expect_hostname") - @test uri.host == test["expect_hostname"] - end - - if haskey(test, "expect_port") - @test uri.port == test["expect_port"] - end - end - end -end diff --git a/test/urls b/test/urls deleted file mode 100644 index c9c60c72c..000000000 --- a/test/urls +++ /dev/null @@ -1,203 +0,0 @@ -http://www.example.com/#%c2%a9 -http://www.example.com/#𐌀ss -http://www.example.com/#%41%a -http://www.example.com/#絽 -http://www.example.com/#a﷐ -http://www.example.com/#asdf#qwer -http://www.example.com/##asdf -http://google.com -http://GoOgLe.CoM/ -http://192.168.0.257/ -http://go/@ogle.com/ -http:////:@/ -http:////asdf@/ -http:////:81/ -http://////@google.com/ -http://@google.com/ -http://lookDEADout.net/ -http://gOoGle.com/ -http://-foo.bar.com -http://foo-.bar.com -http://ab--cd.com -http://xn--0.com -http://./ -http://192.168.0.1/ -http://0300.0250.00.01/ -http://0xC0.0Xa8.0x0.0x1/ -http://192.168.9.com/ -http://19a.168.0.1/ -http://0308.0250.00.01/ -http://0xCG.0xA8.0x0.0x1/ -http://192/ -http://0xC0a80001/ -http://030052000001/ -http://000030052000001/ -http://192.168/ -http://192.0x00A80001/ -http://0xc0.052000001/ -http://192.168.1/ -http://192.168.0.0.1/ -http://192.168.0.1./ -http://192.168.0.1../ -http://192.168..1/ -http://0x100.0/ -http://0x100.0.0/ -http://0x100.0.0.0/ -http://0.0x100.0.0/ -http://0.0.0x100.0/ -http://0.0.0.0x100/ -http://0.0.0x10000/ -http://0.0x1000000/ -http://0x100000000/ -http://0xFF.0/ -http://0xFF.0.0/ -http://0xFF.0.0.0/ -http://0.0xFF.0.0/ -http://0.0.0xFF.0/ -http://0.0.0.0xFF/ -http://0.0.0xFFFF/ -http://0.0xFFFFFF/ -http://0xFFFFFFFF/ -http://276.256.0xf1a2.077777/ -http://192.168.0.257/ -http://192.168.0xa20001/ -http://192.015052000001/ -http://0X12C0a80001/ -http://276.1.2/ -http://0000000000000300.0x00000000000000fF.00000000000000001/ -http://0000000000000300.0xffffffffFFFFFFFF.3022415481470977/ -http://00000000000000000001/ -http://0000000000000000100000000000000001/ -http://0.0.0.000000000000000000z/ -http://0.0.0.100000000000000000z/ -http://0.00.0x.0x0/ -http://[:]/ -http://[::]/ -http://[::1]/ -http://[1::.]/ -http://[::192.168.0.1.]/ -http://[::ffff:192.168.0.1.]/ -http://[000:01:02:003:004:5:6:007.]/ -http://[A:b:c:DE:fF:0:1:aC.]/ -http://[1:0:0:2::3:0.]/ -http://[1::2:0:0:3:0.]/ -http://[::eeee:192.168.0.1.]/ -http://[2001::192.168.0.1.]/ -http://[1:2:192.168.0.1:5:6.]/ -http://[::ffff:192.1.2.]/ -http://[0:0::0:0:8.]/ -http://[2001:db8::1.]/ -http://[2001::db8::1.]/ -http://[2001:db8:::1.]/ -http://[:::.]/ -http://[::192.168.0.0.1.]/ -http://[::ffff:192.168.0.0.1.]/ -http://[1:2:3:4:5:6:7:8:9.]/ -http://[0:0:0:0:0:0:0:192.168.0.1.]/ -http://[1:2:3:4:5:6::192.168.0.1.]/ -http://[1:2:3:4:5:6::8.]/ -http://[1:2:3:4:5:6:7:8:.]/ -http://[1:2:3:4:5:6:192.168.0.1:.]/ -http://[1::%1.]/ -http://[1::%eth0.]/ -http://[1::%.]/ -http://[:0:0::0:0:8.]/ -http://[0:0::0:0:8:.]/ -http://[:0:0::0:0:8:.]/ -http://[::192.168..1.]/ -mailto:addr1 -mailto:addr1@foo.com -mailto:addr1?to=jon -mailto:addr1,addr2 -mailto:addr1%2caddr2 -mailto:𐌀 -mailto:addr1? -JavaScript:Foo -http://www.example.com/././foo -http://www.example.com/./.foo -http://www.example.com/foo/. -http://www.example.com/foo/./ -http://www.example.com/foo/bar/.. -http://www.example.com/foo/bar/../ -http://www.example.com/foo/..bar -http://www.example.com/foo/bar/../ton -http://www.example.com/foo/bar/../ton/../../a -http://www.example.com/foo/../../.. -http://www.example.com/foo/../../../ton -http://www.example.com/foo/%2e -http://www.example.com/foo/%2e%2 -http://www.example.com/foo/%2e./%2e%2e/.%2e/%2e.bar -http://www.example.com////../.. -http://www.example.com/foo/bar//../.. -http://www.example.com/foo/bar//.. -http://www.example.com/foo/bar/.. -http://www.example.com/foo -http://www.example.com/%20foo -http://www.example.com/foo% -http://www.example.com/foo%2 -http://www.example.com/foo%2zbar -http://www.example.com/foo%2©zbar -http://www.example.com/foo%41%7a -http://www.example.com/foo ‘%91 -http://www.example.com/foo%00%51 -http://www.example.com/(%28:%3A%29) -http://www.example.com/%3A%3a%3C%3c -http://www.example.com/foo\tbar -http://www.example.com/%7Ffp3%3Eju%3Dduvgw%3Dd -http://www.example.com/@asdf%40 -http://www.example.com/你好你好 -http://www.example.com/﷐zyx -http://www.example.com/‥/foo -http://www.example.com/DEAD/foo -http://www.example.com//foo -http://www.example.com/‮/foo/‭/bar -http://www.example.com:80/ -http://www.example.com:8080/ -http://www.example.com/?foo=bar -http://www.example.com/?as?df -http://www.example.com/?%40%41123 -http://www.example.com/?q=你好 -http://www.example.com/?q=ﰀ -http://www.example.com/?q=<asdf> -http://www.example.com/?q="asdf" -http://example.com/ -HTTP://example.com/ -http://www.google.com/foo?bar=baz# -http:////////user:@google.com:99?foo -http://192.0x00A80001 -http://www/foo%2Ehtml -http://%25DOMAIN:foobar@foodomain.com/ -http:\\\\www.google.com\\foo -http://www.google.com/asdf#� -http://foo:80/ -http://foo:81/ -httpa://foo:80/ -https://foo:443/ -https://foo:80/ -ftp://foo:21/ -ftp://foo:80/ -gopher://foo:70/ -gopher://foo:443/ -ws://foo:80/ -ws://foo:81/ -ws://foo:443/ -ws://foo:815/ -wss://foo:80/ -wss://foo:81/ -wss://foo:443/ -wss://foo:815/ -http://www.example.com/foo%3fbar -http://www.example.com/foo%2fbar -http://www.example.com/%A1%C1/?foo=%EF%BD%81 -http://www.example.com/%EF%BD%81/?foo=%A1%C1 -http://www.example.com/FOO/?foo=%A1%C1 -http://www.example.com/%A1%C1/?foo=FOO -http://www.example.com/FOO/?foo=%A1%C1 -http://www.example.com/D%FCrst -http://www.example.com/D%C3%BCrst -http://www.example.com/?D%FCrst -http://www.example.com/?D%C3%BCrst -mailto::foo@bar.com -data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC -data::image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC -data:::image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGlSURBVDhPnZDfS1NhGMfff8oLEUE0FBfqmrigi/DKrvKqiNDEKYjCUJdH3I/Q5WoLdYmlU1FP0LQoEclYOCcoMbJuDAUVA/v0vK8/QssL98AH3u97zud7Ho4ajr8i2P8sJ2JDcVSwf5BcR7sqEHpqQpF/60ro0e5Zwb1FiPyAoW14tAIVE5fjGDPKaUHYhOQhTO1DYu+Y/4mn/C0Io3oDAyasCYtHsPALRmUL5+R56j9AdwbsA4jJpnq0q6y+JyboO11ibUBt8jxpuV8VPgn6I5M7cpDRrhSETKiXf3BXuPP+X8Zlo3V5JyUs/4aZXaNIQQj12AqY0CBPL9KW+kIwbWF/b2MqW8d09iZzW27mf0aNo13lOynwpPZpTHpotstpfVOK9105oeUKnqeqiK06iWduMLbhIvG1Gvub2zjaVV09fhPqRgq5nyimYaaEptlrtCfL6Fu6TvhzJREpeZF28nLdxevNamazNcbRrvJ2WiY4/Hm4w/ncihRwO1pwVqjLWuxS2t+W0SVbWR8dDK5UGke7qsPrMyGX0a7y9fSaQy48eNjIH2VPyHZqSIx2AAAAAElFTkSuQmCC