1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
|
# URL tests
## Absolute URL
```url
http://example.com/path?query=value#schema
```
```log
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
```url
/path?query=value#schema
```
```log
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
<!-- meta={"noScan": true} -->
```url
schema:/path?query=value#schema
```
```log
off=0 len=6 span[url.schema]="schema"
off=8 error code=7 reason="Unexpected char in url schema"
```
## Proxy request
```url
http://hostname/
```
```log
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
```url
http://hostname:444/
```
```log
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
```url
http://[1:2::3:4]/
```
```log
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
```url
http://[1:2::3:4]:67/
```
```log
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
```url
http://[2001:0000:0000:0000:0000:0000:1.9.1.1]/
```
```log
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
```url
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
```
```log
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
```url
/toto.html?toto=a%20b
```
```log
off=0 len=10 span[url.path]="/toto.html"
off=11 len=10 span[url.query]="toto=a%20b"
```
## URL fragment
```url
/toto.html#titi
```
```log
off=0 len=10 span[url.path]="/toto.html"
off=11 len=4 span[url.fragment]="titi"
```
## Complex URL fragment
```url
http://www.webmasterworld.com/r.cgi?f=21&d=8405&url=\
http://www.example.com/index.html?foo=bar&hello=world#midpage
```
```log
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
```url
http://host.com:8080/p/a/t/h?query=string#hash
```
```log
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
```url
http://a:b@host.com:8080/p/a/t/h?query=string#hash
```
```log
off=0 len=4 span[url.schema]="http"
off=7 len=17 span[url.host]="a:b@host.com: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 `@`
<!-- meta={"noScan": true} -->
```url
http://a:b@@hostname:443/
```
```log
off=0 len=4 span[url.schema]="http"
off=12 error code=7 reason="Double @ in url"
```
## Proxy basic auth with url encoded space
```url
http://a%20:b@host.com/
```
```log
off=0 len=4 span[url.schema]="http"
off=7 len=15 span[url.host]="a%20:b@host.com"
off=22 len=1 span[url.path]="/"
```
## Proxy basic auth with unreserved chars
```url
http://a!;-_!=+$@host.com/
```
```log
off=0 len=4 span[url.schema]="http"
off=7 len=18 span[url.host]="a!;-_!=+$@host.com"
off=25 len=1 span[url.path]="/"
```
## IPv6 address with Zone ID
```url
http://[fe80::a%25eth0]/
```
```log
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
```url
http://[fe80::a%eth0]/
```
```log
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
<!-- meta={ "noScan": true} -->
```url
/foo\tbar/
```
```log
off=5 error code=7 reason="Invalid characters in url"
```
## Disallow form-feed in URL
<!-- meta={ "noScan": true} -->
```url
/foo\fbar/
```
```log
off=5 error code=7 reason="Invalid characters in url"
```
|