Debian Codegraph @

third_party/python/aiohttp/vendor/llhttp/test/request/uri.md

raw
1 URI
2 ===
3
4 ## Quotes in URI
5
6 <!-- meta={"type": "request"} -->
7 ```http
8 GET /with_"lovely"_quotes?foo=\"bar\" HTTP/1.1
9
10
11 ```
12
13 ```log
14 off=0 message begin
15 off=0 len=3 span[method]="GET"
16 off=3 method complete
17 off=4 len=33 span[url]="/with_"lovely"_quotes?foo=\"bar\""
18 off=38 url complete
19 off=43 len=3 span[version]="1.1"
20 off=46 version complete
21 off=50 headers complete method=1 v=1/1 flags=0 content_length=0
22 off=50 message complete
23 ```
24
25 ## Query URL with question mark
26
27 Some clients include `?` characters in query strings.
28
29 <!-- meta={"type": "request"} -->
30 ```http
31 GET /test.cgi?foo=bar?baz HTTP/1.1
32
33
34 ```
35
36 ```log
37 off=0 message begin
38 off=0 len=3 span[method]="GET"
39 off=3 method complete
40 off=4 len=21 span[url]="/test.cgi?foo=bar?baz"
41 off=26 url complete
42 off=31 len=3 span[version]="1.1"
43 off=34 version complete
44 off=38 headers complete method=1 v=1/1 flags=0 content_length=0
45 off=38 message complete
46 ```
47
48 ## Host terminated by a query string
49
50 <!-- meta={"type": "request"} -->
51 ```http
52 GET http://hypnotoad.org?hail=all HTTP/1.1\r\n
53
54
55 ```
56
57 ```log
58 off=0 message begin
59 off=0 len=3 span[method]="GET"
60 off=3 method complete
61 off=4 len=29 span[url]="http://hypnotoad.org?hail=all"
62 off=34 url complete
63 off=39 len=3 span[version]="1.1"
64 off=42 version complete
65 off=46 headers complete method=1 v=1/1 flags=0 content_length=0
66 off=46 message complete
67 ```
68
69 ## `host:port` terminated by a query string
70
71 <!-- meta={"type": "request"} -->
72 ```http
73 GET http://hypnotoad.org:1234?hail=all HTTP/1.1
74
75
76 ```
77
78 ```log
79 off=0 message begin
80 off=0 len=3 span[method]="GET"
81 off=3 method complete
82 off=4 len=34 span[url]="http://hypnotoad.org:1234?hail=all"
83 off=39 url complete
84 off=44 len=3 span[version]="1.1"
85 off=47 version complete
86 off=51 headers complete method=1 v=1/1 flags=0 content_length=0
87 off=51 message complete
88 ```
89
90 ## Query URL with vertical bar character
91
92 It should be allowed to have vertical bar symbol in URI: `|`.
93
94 See: https://github.com/nodejs/node/issues/27584
95
96 <!-- meta={"type": "request"} -->
97 ```http
98 GET /test.cgi?query=| HTTP/1.1
99
100
101 ```
102
103 ```log
104 off=0 message begin
105 off=0 len=3 span[method]="GET"
106 off=3 method complete
107 off=4 len=17 span[url]="/test.cgi?query=|"
108 off=22 url complete
109 off=27 len=3 span[version]="1.1"
110 off=30 version complete
111 off=34 headers complete method=1 v=1/1 flags=0 content_length=0
112 off=34 message complete
113 ```
114
115 ## `host:port` terminated by a space
116
117 <!-- meta={"type": "request"} -->
118 ```http
119 GET http://hypnotoad.org:1234 HTTP/1.1
120
121
122 ```
123
124 ```log
125 off=0 message begin
126 off=0 len=3 span[method]="GET"
127 off=3 method complete
128 off=4 len=25 span[url]="http://hypnotoad.org:1234"
129 off=30 url complete
130 off=35 len=3 span[version]="1.1"
131 off=38 version complete
132 off=42 headers complete method=1 v=1/1 flags=0 content_length=0
133 off=42 message complete
134 ```
135
136 ## Disallow UTF-8 in URI path in strict mode
137
138 <!-- meta={"type": "request", "noScan": true} -->
139 ```http
140 GET /δ¶/δt/pope?q=1#narf HTTP/1.1
141 Host: github.com
142
143
144 ```
145
146 ```log
147 off=0 message begin
148 off=0 len=3 span[method]="GET"
149 off=3 method complete
150 off=5 error code=7 reason="Invalid char in url path"
151 ```
152
153 ## Fragment in URI
154
155 <!-- meta={"type": "request"} -->
156 ```http
157 GET /forums/1/topics/2375?page=1#posts-17408 HTTP/1.1
158
159
160 ```
161
162 ```log
163 off=0 message begin
164 off=0 len=3 span[method]="GET"
165 off=3 method complete
166 off=4 len=40 span[url]="/forums/1/topics/2375?page=1#posts-17408"
167 off=45 url complete
168 off=50 len=3 span[version]="1.1"
169 off=53 version complete
170 off=57 headers complete method=1 v=1/1 flags=0 content_length=0
171 off=57 message complete
172 ```
173
174 ## Underscore in hostname
175
176 <!-- meta={"type": "request"} -->
177 ```http
178 CONNECT home_0.netscape.com:443 HTTP/1.0
179 User-agent: Mozilla/1.1N
180 Proxy-authorization: basic aGVsbG86d29ybGQ=
181
182
183 ```
184
185 ```log
186 off=0 message begin
187 off=0 len=7 span[method]="CONNECT"
188 off=7 method complete
189 off=8 len=23 span[url]="home_0.netscape.com:443"
190 off=32 url complete
191 off=37 len=3 span[version]="1.0"
192 off=40 version complete
193 off=42 len=10 span[header_field]="User-agent"
194 off=53 header_field complete
195 off=54 len=12 span[header_value]="Mozilla/1.1N"
196 off=68 header_value complete
197 off=68 len=19 span[header_field]="Proxy-authorization"
198 off=88 header_field complete
199 off=89 len=22 span[header_value]="basic aGVsbG86d29ybGQ="
200 off=113 header_value complete
201 off=115 headers complete method=5 v=1/0 flags=0 content_length=0
202 off=115 message complete
203 off=115 error code=22 reason="Pause on CONNECT/Upgrade"
204 ```
205
206 ## `host:port` and basic auth
207
208 <!-- meta={"type": "request"} -->
209 ```http
210 GET http://a%12:b!&*[email protected]:1234/toto HTTP/1.1
211
212
213 ```
214
215 ```log
216 off=0 message begin
217 off=0 len=3 span[method]="GET"
218 off=3 method complete
219 off=4 len=41 span[url]="http://a%12:b!&*[email protected]:1234/toto"
220 off=46 url complete
221 off=51 len=3 span[version]="1.1"
222 off=54 version complete
223 off=58 headers complete method=1 v=1/1 flags=0 content_length=0
224 off=58 message complete
225 ```
226
227 ## Space in URI
228
229 <!-- meta={"type": "request", "noScan": true} -->
230 ```http
231 GET /foo bar/ HTTP/1.1
232
233
234 ```
235
236 ```log
237 off=0 message begin
238 off=0 len=3 span[method]="GET"
239 off=3 method complete
240 off=4 len=4 span[url]="/foo"
241 off=9 url complete
242 off=9 error code=8 reason="Expected HTTP/"
243 ```