Skip to content

Latest commit

 

History

History
283 lines (214 loc) · 5.2 KB

url.md

File metadata and controls

283 lines (214 loc) · 5.2 KB

URL tests

Absolute URL

http://example.com/path?query=value#schema
off=0 len=4 span[url.schema]="http"
off=7 len=11 span[url.host]="example.com"
off=18 len=5 span[url.path]="/path"
off=24 len=11 span[url.query]="query=value"
off=36 len=6 span[url.fragment]="schema"

Relative URL

/path?query=value#schema
off=0 len=5 span[url.path]="/path"
off=6 len=11 span[url.query]="query=value"
off=18 len=6 span[url.fragment]="schema"

Failing on broken schema

schema:/path?query=value#schema
off=0 len=6 span[url.schema]="schema"
off=8 error code=7 reason="Unexpected char in url schema"

Proxy request

http://hostname/
off=0 len=4 span[url.schema]="http"
off=7 len=8 span[url.host]="hostname"
off=15 len=1 span[url.path]="/"

Proxy request with port

http://hostname:444/
off=0 len=4 span[url.schema]="http"
off=7 len=12 span[url.host]="hostname:444"
off=19 len=1 span[url.path]="/"

Proxy IPv6 request

http://[1:2::3:4]/
off=0 len=4 span[url.schema]="http"
off=7 len=10 span[url.host]="[1:2::3:4]"
off=17 len=1 span[url.path]="/"

Proxy IPv6 request with port

http://[1:2::3:4]:67/
off=0 len=4 span[url.schema]="http"
off=7 len=13 span[url.host]="[1:2::3:4]:67"
off=20 len=1 span[url.path]="/"

IPv4 in IPv6 address

http://[2001:0000:0000:0000:0000:0000:1.9.1.1]/
off=0 len=4 span[url.schema]="http"
off=7 len=39 span[url.host]="[2001:0000:0000:0000:0000:0000:1.9.1.1]"
off=46 len=1 span[url.path]="/"

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
off=0 len=4 span[url.schema]="http"
off=7 len=10 span[url.host]="a.tbcdn.cn"
off=17 len=12 span[url.path]="/p/fp/2010c/"
off=30 len=187 span[url.query]="?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"

URL encoded space

/toto.html?toto=a%20b
off=0 len=10 span[url.path]="/toto.html"
off=11 len=10 span[url.query]="toto=a%20b"

URL fragment

/toto.html#titi
off=0 len=10 span[url.path]="/toto.html"
off=11 len=4 span[url.fragment]="titi"

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
off=0 len=4 span[url.schema]="http"
off=7 len=22 span[url.host]="www.webmasterworld.com"
off=29 len=6 span[url.path]="/r.cgi"
off=36 len=69 span[url.query]="f=21&d=8405&url=http://www.example.com/index.html?foo=bar&hello=world"
off=106 len=7 span[url.fragment]="midpage"

Complex URL from node.js url parser doc

http://host.com:8080/p/a/t/h?query=string#hash
off=0 len=4 span[url.schema]="http"
off=7 len=13 span[url.host]="host.com:8080"
off=20 len=8 span[url.path]="/p/a/t/h"
off=29 len=12 span[url.query]="query=string"
off=42 len=4 span[url.fragment]="hash"

Complex URL with basic auth from node.js url parser doc

http://a:[email protected]:8080/p/a/t/h?query=string#hash
off=0 len=4 span[url.schema]="http"
off=7 len=17 span[url.host]="a:[email protected]:8080"
off=24 len=8 span[url.path]="/p/a/t/h"
off=33 len=12 span[url.query]="query=string"
off=46 len=4 span[url.fragment]="hash"

Double @

http://a:b@@hostname:443/
off=0 len=4 span[url.schema]="http"
off=12 error code=7 reason="Double @ in url"

Proxy basic auth with url encoded space

http://a%20:[email protected]/
off=0 len=4 span[url.schema]="http"
off=7 len=15 span[url.host]="a%20:[email protected]"
off=22 len=1 span[url.path]="/"

Proxy basic auth with unreserved chars

off=0 len=4 span[url.schema]="http"
off=7 len=18 span[url.host]="a!;[email protected]"
off=25 len=1 span[url.path]="/"

IPv6 address with Zone ID

http://[fe80::a%25eth0]/
off=0 len=4 span[url.schema]="http"
off=7 len=16 span[url.host]="[fe80::a%25eth0]"
off=23 len=1 span[url.path]="/"

IPv6 address with Zone ID, but % is not percent-encoded

http://[fe80::a%eth0]/
off=0 len=4 span[url.schema]="http"
off=7 len=14 span[url.host]="[fe80::a%eth0]"
off=21 len=1 span[url.path]="/"

Disallow tab in URL in strict mode

/foo\tbar/
off=5 error code=7 reason="Invalid characters in url (strict mode)"

Tab in URL in loose mode

/foo\tbar/
off=0 len=9 span[url.path]="/foo\tbar/"

Disallow form-feed in URL in strict mode

/foo\fbar/
off=5 error code=7 reason="Invalid characters in url (strict mode)"

Form-feed in URL in loose mode

/foo\fbar/
off=0 len=9 span[url.path]="/foo\fbar/"