Debian Codegraph @

third_party/python/aiohttp/vendor/llhttp/test/url.md

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