1
2use httparse::{Error, Request, Status, EMPTY_HEADER};
3
4const NUM_OF_HEADERS: usize = 4;
5
6macro_rules! req {
7 ($name:ident, $buf:expr, |$arg:ident| $body:expr) => (
8 req! {$name, $buf, Ok(Status::Complete($buf.len())), |$arg| $body }
9 );
10 ($name:ident, $buf:expr, $len:expr, |$arg:ident| $body:expr) => (
11 #[test]
12 fn $name() {
13 let mut headers = [EMPTY_HEADER; NUM_OF_HEADERS];
14 let mut req = Request::new(&mut headers[..]);
15 let status = req.parse($buf.as_ref());
16 assert_eq!(status, $len);
17 closure(req);
18
19 fn closure($arg: Request<'_, '_>) {
20 $body
21 }
22 }
23 )
24}
25
26req! {
27 urltest_001,
28 b"GET /bar;par?b HTTP/1.1\r\nHost: foo\r\n\r\n",
29 |req| {
30 assert_eq!(req.method.unwrap(), "GET");
31 assert_eq!(req.path.unwrap(), "/bar;par?b");
32 assert_eq!(req.version.unwrap(), 1);
33 assert_eq!(req.headers.len(), 1);
34 assert_eq!(req.headers[0].name, "Host");
35 assert_eq!(req.headers[0].value, b"foo");
36 }
37}
38
39
40req! {
41 urltest_002,
42 b"GET /x HTTP/1.1\r\nHost: test\r\n\r\n",
43 |req| {
44 assert_eq!(req.method.unwrap(), "GET");
45 assert_eq!(req.path.unwrap(), "/x");
46 assert_eq!(req.version.unwrap(), 1);
47 assert_eq!(req.headers.len(), 1);
48 assert_eq!(req.headers[0].name, "Host");
49 assert_eq!(req.headers[0].value, b"test");
50 }
51}
52
53
54req! {
55 urltest_003,
56 b"GET /x HTTP/1.1\r\nHost: test\r\n\r\n",
57 |req| {
58 assert_eq!(req.method.unwrap(), "GET");
59 assert_eq!(req.path.unwrap(), "/x");
60 assert_eq!(req.version.unwrap(), 1);
61 assert_eq!(req.headers.len(), 1);
62 assert_eq!(req.headers[0].name, "Host");
63 assert_eq!(req.headers[0].value, b"test");
64 }
65}
66
67
68req! {
69 urltest_004,
70 b"GET /foo/foo.com HTTP/1.1\r\nHost: example.org\r\n\r\n",
71 |req| {
72 assert_eq!(req.method.unwrap(), "GET");
73 assert_eq!(req.path.unwrap(), "/foo/foo.com");
74 assert_eq!(req.version.unwrap(), 1);
75 assert_eq!(req.headers.len(), 1);
76 assert_eq!(req.headers[0].name, "Host");
77 assert_eq!(req.headers[0].value, b"example.org");
78 }
79}
80
81
82req! {
83 urltest_005,
84 b"GET /foo/:foo.com HTTP/1.1\r\nHost: example.org\r\n\r\n",
85 |req| {
86 assert_eq!(req.method.unwrap(), "GET");
87 assert_eq!(req.path.unwrap(), "/foo/:foo.com");
88 assert_eq!(req.version.unwrap(), 1);
89 assert_eq!(req.headers.len(), 1);
90 assert_eq!(req.headers[0].name, "Host");
91 assert_eq!(req.headers[0].value, b"example.org");
92 }
93}
94
95
96req! {
97 urltest_006,
98 b"GET /foo/foo.com HTTP/1.1\r\nHost: example.org\r\n\r\n",
99 |req| {
100 assert_eq!(req.method.unwrap(), "GET");
101 assert_eq!(req.path.unwrap(), "/foo/foo.com");
102 assert_eq!(req.version.unwrap(), 1);
103 assert_eq!(req.headers.len(), 1);
104 assert_eq!(req.headers[0].name, "Host");
105 assert_eq!(req.headers[0].value, b"example.org");
106 }
107}
108
109
110req! {
111 urltest_007,
112 b"GET foo.com HTTP/1.1\r\nHost: \r\n\r\n",
113 Err(Error::Token),
114 |_r| {}
115}
116
117
118req! {
119 urltest_008,
120 b"GET /%20b%20?%20d%20 HTTP/1.1\r\nHost: f\r\n\r\n",
121 |req| {
122 assert_eq!(req.method.unwrap(), "GET");
123 assert_eq!(req.path.unwrap(), "/%20b%20?%20d%20");
124 assert_eq!(req.version.unwrap(), 1);
125 assert_eq!(req.headers.len(), 1);
126 assert_eq!(req.headers[0].name, "Host");
127 assert_eq!(req.headers[0].value, b"f");
128 }
129}
130
131
132req! {
133 urltest_009,
134 b"GET x x HTTP/1.1\r\nHost: \r\n\r\n",
135 Err(Error::Version),
136 |_r| {}
137}
138
139
140req! {
141 urltest_010,
142 b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
143 |req| {
144 assert_eq!(req.method.unwrap(), "GET");
145 assert_eq!(req.path.unwrap(), "/c");
146 assert_eq!(req.version.unwrap(), 1);
147 assert_eq!(req.headers.len(), 1);
148 assert_eq!(req.headers[0].name, "Host");
149 assert_eq!(req.headers[0].value, b"f");
150 }
151}
152
153
154req! {
155 urltest_011,
156 b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
157 |req| {
158 assert_eq!(req.method.unwrap(), "GET");
159 assert_eq!(req.path.unwrap(), "/c");
160 assert_eq!(req.version.unwrap(), 1);
161 assert_eq!(req.headers.len(), 1);
162 assert_eq!(req.headers[0].name, "Host");
163 assert_eq!(req.headers[0].value, b"f");
164 }
165}
166
167
168req! {
169 urltest_012,
170 b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
171 |req| {
172 assert_eq!(req.method.unwrap(), "GET");
173 assert_eq!(req.path.unwrap(), "/c");
174 assert_eq!(req.version.unwrap(), 1);
175 assert_eq!(req.headers.len(), 1);
176 assert_eq!(req.headers[0].name, "Host");
177 assert_eq!(req.headers[0].value, b"f");
178 }
179}
180
181
182req! {
183 urltest_013,
184 b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
185 |req| {
186 assert_eq!(req.method.unwrap(), "GET");
187 assert_eq!(req.path.unwrap(), "/c");
188 assert_eq!(req.version.unwrap(), 1);
189 assert_eq!(req.headers.len(), 1);
190 assert_eq!(req.headers[0].name, "Host");
191 assert_eq!(req.headers[0].value, b"f");
192 }
193}
194
195
196req! {
197 urltest_014,
198 b"GET /c HTTP/1.1\r\nHost: f\r\n\r\n",
199 |req| {
200 assert_eq!(req.method.unwrap(), "GET");
201 assert_eq!(req.path.unwrap(), "/c");
202 assert_eq!(req.version.unwrap(), 1);
203 assert_eq!(req.headers.len(), 1);
204 assert_eq!(req.headers[0].name, "Host");
205 assert_eq!(req.headers[0].value, b"f");
206 }
207}
208
209
210req! {
211 urltest_015,
212 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
213 |req| {
214 assert_eq!(req.method.unwrap(), "GET");
215 assert_eq!(req.path.unwrap(), "/foo/bar");
216 assert_eq!(req.version.unwrap(), 1);
217 assert_eq!(req.headers.len(), 1);
218 assert_eq!(req.headers[0].name, "Host");
219 assert_eq!(req.headers[0].value, b"example.org");
220 }
221}
222
223
224req! {
225 urltest_016,
226 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
227 |req| {
228 assert_eq!(req.method.unwrap(), "GET");
229 assert_eq!(req.path.unwrap(), "/foo/bar");
230 assert_eq!(req.version.unwrap(), 1);
231 assert_eq!(req.headers.len(), 1);
232 assert_eq!(req.headers[0].name, "Host");
233 assert_eq!(req.headers[0].value, b"example.org");
234 }
235}
236
237
238req! {
239 urltest_017,
240 b"GET /foo/:foo.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
241 |req| {
242 assert_eq!(req.method.unwrap(), "GET");
243 assert_eq!(req.path.unwrap(), "/foo/:foo.com/");
244 assert_eq!(req.version.unwrap(), 1);
245 assert_eq!(req.headers.len(), 1);
246 assert_eq!(req.headers[0].name, "Host");
247 assert_eq!(req.headers[0].value, b"example.org");
248 }
249}
250
251
252req! {
253 urltest_018,
254 b"GET /foo/:foo.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
255 |req| {
256 assert_eq!(req.method.unwrap(), "GET");
257 assert_eq!(req.path.unwrap(), "/foo/:foo.com/");
258 assert_eq!(req.version.unwrap(), 1);
259 assert_eq!(req.headers.len(), 1);
260 assert_eq!(req.headers[0].name, "Host");
261 assert_eq!(req.headers[0].value, b"example.org");
262 }
263}
264
265
266req! {
267 urltest_019,
268 b"GET /foo/: HTTP/1.1\r\nHost: example.org\r\n\r\n",
269 |req| {
270 assert_eq!(req.method.unwrap(), "GET");
271 assert_eq!(req.path.unwrap(), "/foo/:");
272 assert_eq!(req.version.unwrap(), 1);
273 assert_eq!(req.headers.len(), 1);
274 assert_eq!(req.headers[0].name, "Host");
275 assert_eq!(req.headers[0].value, b"example.org");
276 }
277}
278
279
280req! {
281 urltest_020,
282 b"GET /foo/:a HTTP/1.1\r\nHost: example.org\r\n\r\n",
283 |req| {
284 assert_eq!(req.method.unwrap(), "GET");
285 assert_eq!(req.path.unwrap(), "/foo/:a");
286 assert_eq!(req.version.unwrap(), 1);
287 assert_eq!(req.headers.len(), 1);
288 assert_eq!(req.headers[0].name, "Host");
289 assert_eq!(req.headers[0].value, b"example.org");
290 }
291}
292
293
294req! {
295 urltest_021,
296 b"GET /foo/:/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
297 |req| {
298 assert_eq!(req.method.unwrap(), "GET");
299 assert_eq!(req.path.unwrap(), "/foo/:/");
300 assert_eq!(req.version.unwrap(), 1);
301 assert_eq!(req.headers.len(), 1);
302 assert_eq!(req.headers[0].name, "Host");
303 assert_eq!(req.headers[0].value, b"example.org");
304 }
305}
306
307
308req! {
309 urltest_022,
310 b"GET /foo/:/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
311 |req| {
312 assert_eq!(req.method.unwrap(), "GET");
313 assert_eq!(req.path.unwrap(), "/foo/:/");
314 assert_eq!(req.version.unwrap(), 1);
315 assert_eq!(req.headers.len(), 1);
316 assert_eq!(req.headers[0].name, "Host");
317 assert_eq!(req.headers[0].value, b"example.org");
318 }
319}
320
321
322req! {
323 urltest_023,
324 b"GET /foo/: HTTP/1.1\r\nHost: example.org\r\n\r\n",
325 |req| {
326 assert_eq!(req.method.unwrap(), "GET");
327 assert_eq!(req.path.unwrap(), "/foo/:");
328 assert_eq!(req.version.unwrap(), 1);
329 assert_eq!(req.headers.len(), 1);
330 assert_eq!(req.headers[0].name, "Host");
331 assert_eq!(req.headers[0].value, b"example.org");
332 }
333}
334
335
336req! {
337 urltest_024,
338 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
339 |req| {
340 assert_eq!(req.method.unwrap(), "GET");
341 assert_eq!(req.path.unwrap(), "/foo/bar");
342 assert_eq!(req.version.unwrap(), 1);
343 assert_eq!(req.headers.len(), 1);
344 assert_eq!(req.headers[0].name, "Host");
345 assert_eq!(req.headers[0].value, b"example.org");
346 }
347}
348
349
350req! {
351 urltest_025,
352 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
353 |req| {
354 assert_eq!(req.method.unwrap(), "GET");
355 assert_eq!(req.path.unwrap(), "/foo/bar");
356 assert_eq!(req.version.unwrap(), 1);
357 assert_eq!(req.headers.len(), 1);
358 assert_eq!(req.headers[0].name, "Host");
359 assert_eq!(req.headers[0].value, b"example.org");
360 }
361}
362
363
364req! {
365 urltest_026,
366 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
367 |req| {
368 assert_eq!(req.method.unwrap(), "GET");
369 assert_eq!(req.path.unwrap(), "/foo/bar");
370 assert_eq!(req.version.unwrap(), 1);
371 assert_eq!(req.headers.len(), 1);
372 assert_eq!(req.headers[0].name, "Host");
373 assert_eq!(req.headers[0].value, b"example.org");
374 }
375}
376
377
378req! {
379 urltest_027,
380 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
381 |req| {
382 assert_eq!(req.method.unwrap(), "GET");
383 assert_eq!(req.path.unwrap(), "/foo/bar");
384 assert_eq!(req.version.unwrap(), 1);
385 assert_eq!(req.headers.len(), 1);
386 assert_eq!(req.headers[0].name, "Host");
387 assert_eq!(req.headers[0].value, b"example.org");
388 }
389}
390
391
392req! {
393 urltest_028,
394 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
395 |req| {
396 assert_eq!(req.method.unwrap(), "GET");
397 assert_eq!(req.path.unwrap(), "/foo/bar");
398 assert_eq!(req.version.unwrap(), 1);
399 assert_eq!(req.headers.len(), 1);
400 assert_eq!(req.headers[0].name, "Host");
401 assert_eq!(req.headers[0].value, b"example.org");
402 }
403}
404
405
406req! {
407 urltest_029,
408 b"GET /foo/:23 HTTP/1.1\r\nHost: example.org\r\n\r\n",
409 |req| {
410 assert_eq!(req.method.unwrap(), "GET");
411 assert_eq!(req.path.unwrap(), "/foo/:23");
412 assert_eq!(req.version.unwrap(), 1);
413 assert_eq!(req.headers.len(), 1);
414 assert_eq!(req.headers[0].name, "Host");
415 assert_eq!(req.headers[0].value, b"example.org");
416 }
417}
418
419
420req! {
421 urltest_030,
422 b"GET /:23 HTTP/1.1\r\nHost: example.org\r\n\r\n",
423 |req| {
424 assert_eq!(req.method.unwrap(), "GET");
425 assert_eq!(req.path.unwrap(), "/:23");
426 assert_eq!(req.version.unwrap(), 1);
427 assert_eq!(req.headers.len(), 1);
428 assert_eq!(req.headers[0].name, "Host");
429 assert_eq!(req.headers[0].value, b"example.org");
430 }
431}
432
433
434req! {
435 urltest_031,
436 b"GET /foo/:: HTTP/1.1\r\nHost: example.org\r\n\r\n",
437 |req| {
438 assert_eq!(req.method.unwrap(), "GET");
439 assert_eq!(req.path.unwrap(), "/foo/::");
440 assert_eq!(req.version.unwrap(), 1);
441 assert_eq!(req.headers.len(), 1);
442 assert_eq!(req.headers[0].name, "Host");
443 assert_eq!(req.headers[0].value, b"example.org");
444 }
445}
446
447
448req! {
449 urltest_032,
450 b"GET /foo/::23 HTTP/1.1\r\nHost: example.org\r\n\r\n",
451 |req| {
452 assert_eq!(req.method.unwrap(), "GET");
453 assert_eq!(req.path.unwrap(), "/foo/::23");
454 assert_eq!(req.version.unwrap(), 1);
455 assert_eq!(req.headers.len(), 1);
456 assert_eq!(req.headers[0].name, "Host");
457 assert_eq!(req.headers[0].value, b"example.org");
458 }
459}
460
461
462req! {
463 urltest_033,
464 b"GET /d HTTP/1.1\r\nHost: c\r\n\r\n",
465 |req| {
466 assert_eq!(req.method.unwrap(), "GET");
467 assert_eq!(req.path.unwrap(), "/d");
468 assert_eq!(req.version.unwrap(), 1);
469 assert_eq!(req.headers.len(), 1);
470 assert_eq!(req.headers[0].name, "Host");
471 assert_eq!(req.headers[0].value, b"c");
472 }
473}
474
475
476req! {
477 urltest_034,
478 b"GET /foo/:@c:29 HTTP/1.1\r\nHost: example.org\r\n\r\n",
479 |req| {
480 assert_eq!(req.method.unwrap(), "GET");
481 assert_eq!(req.path.unwrap(), "/foo/:@c:29");
482 assert_eq!(req.version.unwrap(), 1);
483 assert_eq!(req.headers.len(), 1);
484 assert_eq!(req.headers[0].name, "Host");
485 assert_eq!(req.headers[0].value, b"example.org");
486 }
487}
488
489
490req! {
491 urltest_035,
492 b"GET //@ HTTP/1.1\r\nHost: foo.com\r\n\r\n",
493 |req| {
494 assert_eq!(req.method.unwrap(), "GET");
495 assert_eq!(req.path.unwrap(), "//@");
496 assert_eq!(req.version.unwrap(), 1);
497 assert_eq!(req.headers.len(), 1);
498 assert_eq!(req.headers[0].name, "Host");
499 assert_eq!(req.headers[0].value, b"foo.com");
500 }
501}
502
503
504req! {
505 urltest_036,
506 b"GET /b:c/d@foo.com/ HTTP/1.1\r\nHost: a\r\n\r\n",
507 |req| {
508 assert_eq!(req.method.unwrap(), "GET");
509 assert_eq!(req.path.unwrap(), "/b:c/d@foo.com/");
510 assert_eq!(req.version.unwrap(), 1);
511 assert_eq!(req.headers.len(), 1);
512 assert_eq!(req.headers[0].name, "Host");
513 assert_eq!(req.headers[0].value, b"a");
514 }
515}
516
517
518req! {
519 urltest_037,
520 b"GET /bar.com/ HTTP/1.1\r\nHost: \r\n\r\n",
521 |req| {
522 assert_eq!(req.method.unwrap(), "GET");
523 assert_eq!(req.path.unwrap(), "/bar.com/");
524 assert_eq!(req.version.unwrap(), 1);
525 assert_eq!(req.headers.len(), 1);
526 assert_eq!(req.headers[0].name, "Host");
527 assert_eq!(req.headers[0].value, b"");
528 }
529}
530
531
532req! {
533 urltest_038,
534 b"GET /////// HTTP/1.1\r\nHost: \r\n\r\n",
535 |req| {
536 assert_eq!(req.method.unwrap(), "GET");
537 assert_eq!(req.path.unwrap(), "///////");
538 assert_eq!(req.version.unwrap(), 1);
539 assert_eq!(req.headers.len(), 1);
540 assert_eq!(req.headers[0].name, "Host");
541 assert_eq!(req.headers[0].value, b"");
542 }
543}
544
545
546req! {
547 urltest_039,
548 b"GET ///////bar.com/ HTTP/1.1\r\nHost: \r\n\r\n",
549 |req| {
550 assert_eq!(req.method.unwrap(), "GET");
551 assert_eq!(req.path.unwrap(), "///////bar.com/");
552 assert_eq!(req.version.unwrap(), 1);
553 assert_eq!(req.headers.len(), 1);
554 assert_eq!(req.headers[0].name, "Host");
555 assert_eq!(req.headers[0].value, b"");
556 }
557}
558
559
560req! {
561 urltest_040,
562 b"GET //:///// HTTP/1.1\r\nHost: \r\n\r\n",
563 |req| {
564 assert_eq!(req.method.unwrap(), "GET");
565 assert_eq!(req.path.unwrap(), "//://///");
566 assert_eq!(req.version.unwrap(), 1);
567 assert_eq!(req.headers.len(), 1);
568 assert_eq!(req.headers[0].name, "Host");
569 assert_eq!(req.headers[0].value, b"");
570 }
571}
572
573
574req! {
575 urltest_041,
576 b"GET /foo HTTP/1.1\r\nHost: \r\n\r\n",
577 |req| {
578 assert_eq!(req.method.unwrap(), "GET");
579 assert_eq!(req.path.unwrap(), "/foo");
580 assert_eq!(req.version.unwrap(), 1);
581 assert_eq!(req.headers.len(), 1);
582 assert_eq!(req.headers[0].name, "Host");
583 assert_eq!(req.headers[0].value, b"");
584 }
585}
586
587
588req! {
589 urltest_042,
590 b"GET /bar HTTP/1.1\r\nHost: foo\r\n\r\n",
591 |req| {
592 assert_eq!(req.method.unwrap(), "GET");
593 assert_eq!(req.path.unwrap(), "/bar");
594 assert_eq!(req.version.unwrap(), 1);
595 assert_eq!(req.headers.len(), 1);
596 assert_eq!(req.headers[0].name, "Host");
597 assert_eq!(req.headers[0].value, b"foo");
598 }
599}
600
601
602req! {
603 urltest_043,
604 b"GET /path;a??e HTTP/1.1\r\nHost: foo\r\n\r\n",
605 |req| {
606 assert_eq!(req.method.unwrap(), "GET");
607 assert_eq!(req.path.unwrap(), "/path;a??e");
608 assert_eq!(req.version.unwrap(), 1);
609 assert_eq!(req.headers.len(), 1);
610 assert_eq!(req.headers[0].name, "Host");
611 assert_eq!(req.headers[0].value, b"foo");
612 }
613}
614
615
616req! {
617 urltest_044,
618 b"GET /abcd?efgh?ijkl HTTP/1.1\r\nHost: foo\r\n\r\n",
619 |req| {
620 assert_eq!(req.method.unwrap(), "GET");
621 assert_eq!(req.path.unwrap(), "/abcd?efgh?ijkl");
622 assert_eq!(req.version.unwrap(), 1);
623 assert_eq!(req.headers.len(), 1);
624 assert_eq!(req.headers[0].name, "Host");
625 assert_eq!(req.headers[0].value, b"foo");
626 }
627}
628
629
630req! {
631 urltest_045,
632 b"GET /abcd HTTP/1.1\r\nHost: foo\r\n\r\n",
633 |req| {
634 assert_eq!(req.method.unwrap(), "GET");
635 assert_eq!(req.path.unwrap(), "/abcd");
636 assert_eq!(req.version.unwrap(), 1);
637 assert_eq!(req.headers.len(), 1);
638 assert_eq!(req.headers[0].name, "Host");
639 assert_eq!(req.headers[0].value, b"foo");
640 }
641}
642
643
644req! {
645 urltest_046,
646 b"GET /foo/[61:24:74]:98 HTTP/1.1\r\nHost: example.org\r\n\r\n",
647 |req| {
648 assert_eq!(req.method.unwrap(), "GET");
649 assert_eq!(req.path.unwrap(), "/foo/[61:24:74]:98");
650 assert_eq!(req.version.unwrap(), 1);
651 assert_eq!(req.headers.len(), 1);
652 assert_eq!(req.headers[0].name, "Host");
653 assert_eq!(req.headers[0].value, b"example.org");
654 }
655}
656
657
658req! {
659 urltest_047,
660 b"GET /foo/[61:27]/:foo HTTP/1.1\r\nHost: example.org\r\n\r\n",
661 |req| {
662 assert_eq!(req.method.unwrap(), "GET");
663 assert_eq!(req.path.unwrap(), "/foo/[61:27]/:foo");
664 assert_eq!(req.version.unwrap(), 1);
665 assert_eq!(req.headers.len(), 1);
666 assert_eq!(req.headers[0].name, "Host");
667 assert_eq!(req.headers[0].value, b"example.org");
668 }
669}
670
671
672req! {
673 urltest_048,
674 b"GET /example.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
675 |req| {
676 assert_eq!(req.method.unwrap(), "GET");
677 assert_eq!(req.path.unwrap(), "/example.com/");
678 assert_eq!(req.version.unwrap(), 1);
679 assert_eq!(req.headers.len(), 1);
680 assert_eq!(req.headers[0].name, "Host");
681 assert_eq!(req.headers[0].value, b"example.org");
682 }
683}
684
685
686req! {
687 urltest_049,
688 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
689 |req| {
690 assert_eq!(req.method.unwrap(), "GET");
691 assert_eq!(req.path.unwrap(), "/example.com/");
692 assert_eq!(req.version.unwrap(), 1);
693 assert_eq!(req.headers.len(), 1);
694 assert_eq!(req.headers[0].name, "Host");
695 assert_eq!(req.headers[0].value, b"");
696 }
697}
698
699
700req! {
701 urltest_050,
702 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
703 |req| {
704 assert_eq!(req.method.unwrap(), "GET");
705 assert_eq!(req.path.unwrap(), "/example.com/");
706 assert_eq!(req.version.unwrap(), 1);
707 assert_eq!(req.headers.len(), 1);
708 assert_eq!(req.headers[0].name, "Host");
709 assert_eq!(req.headers[0].value, b"");
710 }
711}
712
713
714req! {
715 urltest_051,
716 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
717 |req| {
718 assert_eq!(req.method.unwrap(), "GET");
719 assert_eq!(req.path.unwrap(), "/example.com/");
720 assert_eq!(req.version.unwrap(), 1);
721 assert_eq!(req.headers.len(), 1);
722 assert_eq!(req.headers[0].name, "Host");
723 assert_eq!(req.headers[0].value, b"");
724 }
725}
726
727
728req! {
729 urltest_052,
730 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
731 |req| {
732 assert_eq!(req.method.unwrap(), "GET");
733 assert_eq!(req.path.unwrap(), "/example.com/");
734 assert_eq!(req.version.unwrap(), 1);
735 assert_eq!(req.headers.len(), 1);
736 assert_eq!(req.headers[0].name, "Host");
737 assert_eq!(req.headers[0].value, b"");
738 }
739}
740
741
742req! {
743 urltest_053,
744 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
745 |req| {
746 assert_eq!(req.method.unwrap(), "GET");
747 assert_eq!(req.path.unwrap(), "/example.com/");
748 assert_eq!(req.version.unwrap(), 1);
749 assert_eq!(req.headers.len(), 1);
750 assert_eq!(req.headers[0].name, "Host");
751 assert_eq!(req.headers[0].value, b"");
752 }
753}
754
755
756req! {
757 urltest_054,
758 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
759 |req| {
760 assert_eq!(req.method.unwrap(), "GET");
761 assert_eq!(req.path.unwrap(), "/example.com/");
762 assert_eq!(req.version.unwrap(), 1);
763 assert_eq!(req.headers.len(), 1);
764 assert_eq!(req.headers[0].name, "Host");
765 assert_eq!(req.headers[0].value, b"");
766 }
767}
768
769
770req! {
771 urltest_055,
772 b"GET /foo/example.com/ HTTP/1.1\r\nHost: example.org\r\n\r\n",
773 |req| {
774 assert_eq!(req.method.unwrap(), "GET");
775 assert_eq!(req.path.unwrap(), "/foo/example.com/");
776 assert_eq!(req.version.unwrap(), 1);
777 assert_eq!(req.headers.len(), 1);
778 assert_eq!(req.headers[0].name, "Host");
779 assert_eq!(req.headers[0].value, b"example.org");
780 }
781}
782
783
784req! {
785 urltest_056,
786 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
787 |req| {
788 assert_eq!(req.method.unwrap(), "GET");
789 assert_eq!(req.path.unwrap(), "example.com/");
790 assert_eq!(req.version.unwrap(), 1);
791 assert_eq!(req.headers.len(), 1);
792 assert_eq!(req.headers[0].name, "Host");
793 assert_eq!(req.headers[0].value, b"");
794 }
795}
796
797
798req! {
799 urltest_057,
800 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
801 |req| {
802 assert_eq!(req.method.unwrap(), "GET");
803 assert_eq!(req.path.unwrap(), "example.com/");
804 assert_eq!(req.version.unwrap(), 1);
805 assert_eq!(req.headers.len(), 1);
806 assert_eq!(req.headers[0].name, "Host");
807 assert_eq!(req.headers[0].value, b"");
808 }
809}
810
811
812req! {
813 urltest_058,
814 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
815 |req| {
816 assert_eq!(req.method.unwrap(), "GET");
817 assert_eq!(req.path.unwrap(), "example.com/");
818 assert_eq!(req.version.unwrap(), 1);
819 assert_eq!(req.headers.len(), 1);
820 assert_eq!(req.headers[0].name, "Host");
821 assert_eq!(req.headers[0].value, b"");
822 }
823}
824
825
826req! {
827 urltest_059,
828 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
829 |req| {
830 assert_eq!(req.method.unwrap(), "GET");
831 assert_eq!(req.path.unwrap(), "example.com/");
832 assert_eq!(req.version.unwrap(), 1);
833 assert_eq!(req.headers.len(), 1);
834 assert_eq!(req.headers[0].name, "Host");
835 assert_eq!(req.headers[0].value, b"");
836 }
837}
838
839
840req! {
841 urltest_060,
842 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
843 |req| {
844 assert_eq!(req.method.unwrap(), "GET");
845 assert_eq!(req.path.unwrap(), "example.com/");
846 assert_eq!(req.version.unwrap(), 1);
847 assert_eq!(req.headers.len(), 1);
848 assert_eq!(req.headers[0].name, "Host");
849 assert_eq!(req.headers[0].value, b"");
850 }
851}
852
853
854req! {
855 urltest_061,
856 b"GET /a/b/c HTTP/1.1\r\nHost: example.org\r\n\r\n",
857 |req| {
858 assert_eq!(req.method.unwrap(), "GET");
859 assert_eq!(req.path.unwrap(), "/a/b/c");
860 assert_eq!(req.version.unwrap(), 1);
861 assert_eq!(req.headers.len(), 1);
862 assert_eq!(req.headers[0].name, "Host");
863 assert_eq!(req.headers[0].value, b"example.org");
864 }
865}
866
867
868req! {
869 urltest_062,
870 b"GET /a/%20/c HTTP/1.1\r\nHost: example.org\r\n\r\n",
871 |req| {
872 assert_eq!(req.method.unwrap(), "GET");
873 assert_eq!(req.path.unwrap(), "/a/%20/c");
874 assert_eq!(req.version.unwrap(), 1);
875 assert_eq!(req.headers.len(), 1);
876 assert_eq!(req.headers[0].name, "Host");
877 assert_eq!(req.headers[0].value, b"example.org");
878 }
879}
880
881
882req! {
883 urltest_063,
884 b"GET /a%2fc HTTP/1.1\r\nHost: example.org\r\n\r\n",
885 |req| {
886 assert_eq!(req.method.unwrap(), "GET");
887 assert_eq!(req.path.unwrap(), "/a%2fc");
888 assert_eq!(req.version.unwrap(), 1);
889 assert_eq!(req.headers.len(), 1);
890 assert_eq!(req.headers[0].name, "Host");
891 assert_eq!(req.headers[0].value, b"example.org");
892 }
893}
894
895
896req! {
897 urltest_064,
898 b"GET /a/%2f/c HTTP/1.1\r\nHost: example.org\r\n\r\n",
899 |req| {
900 assert_eq!(req.method.unwrap(), "GET");
901 assert_eq!(req.path.unwrap(), "/a/%2f/c");
902 assert_eq!(req.version.unwrap(), 1);
903 assert_eq!(req.headers.len(), 1);
904 assert_eq!(req.headers[0].name, "Host");
905 assert_eq!(req.headers[0].value, b"example.org");
906 }
907}
908
909
910req! {
911 urltest_065,
912 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
913 |req| {
914 assert_eq!(req.method.unwrap(), "GET");
915 assert_eq!(req.path.unwrap(), "/foo/bar");
916 assert_eq!(req.version.unwrap(), 1);
917 assert_eq!(req.headers.len(), 1);
918 assert_eq!(req.headers[0].name, "Host");
919 assert_eq!(req.headers[0].value, b"example.org");
920 }
921}
922
923
924req! {
925 urltest_066,
926 b"GET text/html,test HTTP/1.1\r\nHost: \r\n\r\n",
927 |req| {
928 assert_eq!(req.method.unwrap(), "GET");
929 assert_eq!(req.path.unwrap(), "text/html,test");
930 assert_eq!(req.version.unwrap(), 1);
931 assert_eq!(req.headers.len(), 1);
932 assert_eq!(req.headers[0].name, "Host");
933 assert_eq!(req.headers[0].value, b"");
934 }
935}
936
937
938req! {
939 urltest_067,
940 b"GET 1234567890 HTTP/1.1\r\nHost: \r\n\r\n",
941 |req| {
942 assert_eq!(req.method.unwrap(), "GET");
943 assert_eq!(req.path.unwrap(), "1234567890");
944 assert_eq!(req.version.unwrap(), 1);
945 assert_eq!(req.headers.len(), 1);
946 assert_eq!(req.headers[0].name, "Host");
947 assert_eq!(req.headers[0].value, b"");
948 }
949}
950
951
952req! {
953 urltest_068,
954 b"GET /c:/foo/bar.html HTTP/1.1\r\nHost: \r\n\r\n",
955 |req| {
956 assert_eq!(req.method.unwrap(), "GET");
957 assert_eq!(req.path.unwrap(), "/c:/foo/bar.html");
958 assert_eq!(req.version.unwrap(), 1);
959 assert_eq!(req.headers.len(), 1);
960 assert_eq!(req.headers[0].name, "Host");
961 assert_eq!(req.headers[0].value, b"");
962 }
963}
964
965
966req! {
967 urltest_069,
968 b"GET /c:////foo/bar.html HTTP/1.1\r\nHost: \r\n\r\n",
969 |req| {
970 assert_eq!(req.method.unwrap(), "GET");
971 assert_eq!(req.path.unwrap(), "/c:////foo/bar.html");
972 assert_eq!(req.version.unwrap(), 1);
973 assert_eq!(req.headers.len(), 1);
974 assert_eq!(req.headers[0].name, "Host");
975 assert_eq!(req.headers[0].value, b"");
976 }
977}
978
979
980req! {
981 urltest_070,
982 b"GET /C:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
983 |req| {
984 assert_eq!(req.method.unwrap(), "GET");
985 assert_eq!(req.path.unwrap(), "/C:/foo/bar");
986 assert_eq!(req.version.unwrap(), 1);
987 assert_eq!(req.headers.len(), 1);
988 assert_eq!(req.headers[0].name, "Host");
989 assert_eq!(req.headers[0].value, b"");
990 }
991}
992
993
994req! {
995 urltest_071,
996 b"GET /C:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
997 |req| {
998 assert_eq!(req.method.unwrap(), "GET");
999 assert_eq!(req.path.unwrap(), "/C:/foo/bar");
1000 assert_eq!(req.version.unwrap(), 1);
1001 assert_eq!(req.headers.len(), 1);
1002 assert_eq!(req.headers[0].name, "Host");
1003 assert_eq!(req.headers[0].value, b"");
1004 }
1005}
1006
1007
1008req! {
1009 urltest_072,
1010 b"GET /C:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
1011 |req| {
1012 assert_eq!(req.method.unwrap(), "GET");
1013 assert_eq!(req.path.unwrap(), "/C:/foo/bar");
1014 assert_eq!(req.version.unwrap(), 1);
1015 assert_eq!(req.headers.len(), 1);
1016 assert_eq!(req.headers[0].name, "Host");
1017 assert_eq!(req.headers[0].value, b"");
1018 }
1019}
1020
1021
1022req! {
1023 urltest_073,
1024 b"GET /file HTTP/1.1\r\nHost: server\r\n\r\n",
1025 |req| {
1026 assert_eq!(req.method.unwrap(), "GET");
1027 assert_eq!(req.path.unwrap(), "/file");
1028 assert_eq!(req.version.unwrap(), 1);
1029 assert_eq!(req.headers.len(), 1);
1030 assert_eq!(req.headers[0].name, "Host");
1031 assert_eq!(req.headers[0].value, b"server");
1032 }
1033}
1034
1035
1036req! {
1037 urltest_074,
1038 b"GET /file HTTP/1.1\r\nHost: server\r\n\r\n",
1039 |req| {
1040 assert_eq!(req.method.unwrap(), "GET");
1041 assert_eq!(req.path.unwrap(), "/file");
1042 assert_eq!(req.version.unwrap(), 1);
1043 assert_eq!(req.headers.len(), 1);
1044 assert_eq!(req.headers[0].name, "Host");
1045 assert_eq!(req.headers[0].value, b"server");
1046 }
1047}
1048
1049
1050req! {
1051 urltest_075,
1052 b"GET /file HTTP/1.1\r\nHost: server\r\n\r\n",
1053 |req| {
1054 assert_eq!(req.method.unwrap(), "GET");
1055 assert_eq!(req.path.unwrap(), "/file");
1056 assert_eq!(req.version.unwrap(), 1);
1057 assert_eq!(req.headers.len(), 1);
1058 assert_eq!(req.headers[0].name, "Host");
1059 assert_eq!(req.headers[0].value, b"server");
1060 }
1061}
1062
1063
1064req! {
1065 urltest_076,
1066 b"GET /foo/bar.txt HTTP/1.1\r\nHost: \r\n\r\n",
1067 |req| {
1068 assert_eq!(req.method.unwrap(), "GET");
1069 assert_eq!(req.path.unwrap(), "/foo/bar.txt");
1070 assert_eq!(req.version.unwrap(), 1);
1071 assert_eq!(req.headers.len(), 1);
1072 assert_eq!(req.headers[0].name, "Host");
1073 assert_eq!(req.headers[0].value, b"");
1074 }
1075}
1076
1077
1078req! {
1079 urltest_077,
1080 b"GET /home/me HTTP/1.1\r\nHost: \r\n\r\n",
1081 |req| {
1082 assert_eq!(req.method.unwrap(), "GET");
1083 assert_eq!(req.path.unwrap(), "/home/me");
1084 assert_eq!(req.version.unwrap(), 1);
1085 assert_eq!(req.headers.len(), 1);
1086 assert_eq!(req.headers[0].name, "Host");
1087 assert_eq!(req.headers[0].value, b"");
1088 }
1089}
1090
1091
1092req! {
1093 urltest_078,
1094 b"GET /test HTTP/1.1\r\nHost: \r\n\r\n",
1095 |req| {
1096 assert_eq!(req.method.unwrap(), "GET");
1097 assert_eq!(req.path.unwrap(), "/test");
1098 assert_eq!(req.version.unwrap(), 1);
1099 assert_eq!(req.headers.len(), 1);
1100 assert_eq!(req.headers[0].name, "Host");
1101 assert_eq!(req.headers[0].value, b"");
1102 }
1103}
1104
1105
1106req! {
1107 urltest_079,
1108 b"GET /test HTTP/1.1\r\nHost: \r\n\r\n",
1109 |req| {
1110 assert_eq!(req.method.unwrap(), "GET");
1111 assert_eq!(req.path.unwrap(), "/test");
1112 assert_eq!(req.version.unwrap(), 1);
1113 assert_eq!(req.headers.len(), 1);
1114 assert_eq!(req.headers[0].name, "Host");
1115 assert_eq!(req.headers[0].value, b"");
1116 }
1117}
1118
1119
1120req! {
1121 urltest_080,
1122 b"GET /tmp/mock/test HTTP/1.1\r\nHost: \r\n\r\n",
1123 |req| {
1124 assert_eq!(req.method.unwrap(), "GET");
1125 assert_eq!(req.path.unwrap(), "/tmp/mock/test");
1126 assert_eq!(req.version.unwrap(), 1);
1127 assert_eq!(req.headers.len(), 1);
1128 assert_eq!(req.headers[0].name, "Host");
1129 assert_eq!(req.headers[0].value, b"");
1130 }
1131}
1132
1133
1134req! {
1135 urltest_081,
1136 b"GET /tmp/mock/test HTTP/1.1\r\nHost: \r\n\r\n",
1137 |req| {
1138 assert_eq!(req.method.unwrap(), "GET");
1139 assert_eq!(req.path.unwrap(), "/tmp/mock/test");
1140 assert_eq!(req.version.unwrap(), 1);
1141 assert_eq!(req.headers.len(), 1);
1142 assert_eq!(req.headers[0].name, "Host");
1143 assert_eq!(req.headers[0].value, b"");
1144 }
1145}
1146
1147
1148req! {
1149 urltest_082,
1150 b"GET /foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
1151 |req| {
1152 assert_eq!(req.method.unwrap(), "GET");
1153 assert_eq!(req.path.unwrap(), "/foo");
1154 assert_eq!(req.version.unwrap(), 1);
1155 assert_eq!(req.headers.len(), 1);
1156 assert_eq!(req.headers[0].name, "Host");
1157 assert_eq!(req.headers[0].value, b"example.com");
1158 }
1159}
1160
1161
1162req! {
1163 urltest_083,
1164 b"GET /.foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
1165 |req| {
1166 assert_eq!(req.method.unwrap(), "GET");
1167 assert_eq!(req.path.unwrap(), "/.foo");
1168 assert_eq!(req.version.unwrap(), 1);
1169 assert_eq!(req.headers.len(), 1);
1170 assert_eq!(req.headers[0].name, "Host");
1171 assert_eq!(req.headers[0].value, b"example.com");
1172 }
1173}
1174
1175
1176req! {
1177 urltest_084,
1178 b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
1179 |req| {
1180 assert_eq!(req.method.unwrap(), "GET");
1181 assert_eq!(req.path.unwrap(), "/foo/");
1182 assert_eq!(req.version.unwrap(), 1);
1183 assert_eq!(req.headers.len(), 1);
1184 assert_eq!(req.headers[0].name, "Host");
1185 assert_eq!(req.headers[0].value, b"example.com");
1186 }
1187}
1188
1189
1190req! {
1191 urltest_085,
1192 b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
1193 |req| {
1194 assert_eq!(req.method.unwrap(), "GET");
1195 assert_eq!(req.path.unwrap(), "/foo/");
1196 assert_eq!(req.version.unwrap(), 1);
1197 assert_eq!(req.headers.len(), 1);
1198 assert_eq!(req.headers[0].name, "Host");
1199 assert_eq!(req.headers[0].value, b"example.com");
1200 }
1201}
1202
1203
1204req! {
1205 urltest_086,
1206 b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
1207 |req| {
1208 assert_eq!(req.method.unwrap(), "GET");
1209 assert_eq!(req.path.unwrap(), "/foo/");
1210 assert_eq!(req.version.unwrap(), 1);
1211 assert_eq!(req.headers.len(), 1);
1212 assert_eq!(req.headers[0].name, "Host");
1213 assert_eq!(req.headers[0].value, b"example.com");
1214 }
1215}
1216
1217
1218req! {
1219 urltest_087,
1220 b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
1221 |req| {
1222 assert_eq!(req.method.unwrap(), "GET");
1223 assert_eq!(req.path.unwrap(), "/foo/");
1224 assert_eq!(req.version.unwrap(), 1);
1225 assert_eq!(req.headers.len(), 1);
1226 assert_eq!(req.headers[0].name, "Host");
1227 assert_eq!(req.headers[0].value, b"example.com");
1228 }
1229}
1230
1231
1232req! {
1233 urltest_088,
1234 b"GET /foo/..bar HTTP/1.1\r\nHost: example.com\r\n\r\n",
1235 |req| {
1236 assert_eq!(req.method.unwrap(), "GET");
1237 assert_eq!(req.path.unwrap(), "/foo/..bar");
1238 assert_eq!(req.version.unwrap(), 1);
1239 assert_eq!(req.headers.len(), 1);
1240 assert_eq!(req.headers[0].name, "Host");
1241 assert_eq!(req.headers[0].value, b"example.com");
1242 }
1243}
1244
1245
1246req! {
1247 urltest_089,
1248 b"GET /foo/ton HTTP/1.1\r\nHost: example.com\r\n\r\n",
1249 |req| {
1250 assert_eq!(req.method.unwrap(), "GET");
1251 assert_eq!(req.path.unwrap(), "/foo/ton");
1252 assert_eq!(req.version.unwrap(), 1);
1253 assert_eq!(req.headers.len(), 1);
1254 assert_eq!(req.headers[0].name, "Host");
1255 assert_eq!(req.headers[0].value, b"example.com");
1256 }
1257}
1258
1259
1260req! {
1261 urltest_090,
1262 b"GET /a HTTP/1.1\r\nHost: example.com\r\n\r\n",
1263 |req| {
1264 assert_eq!(req.method.unwrap(), "GET");
1265 assert_eq!(req.path.unwrap(), "/a");
1266 assert_eq!(req.version.unwrap(), 1);
1267 assert_eq!(req.headers.len(), 1);
1268 assert_eq!(req.headers[0].name, "Host");
1269 assert_eq!(req.headers[0].value, b"example.com");
1270 }
1271}
1272
1273
1274req! {
1275 urltest_091,
1276 b"GET /ton HTTP/1.1\r\nHost: example.com\r\n\r\n",
1277 |req| {
1278 assert_eq!(req.method.unwrap(), "GET");
1279 assert_eq!(req.path.unwrap(), "/ton");
1280 assert_eq!(req.version.unwrap(), 1);
1281 assert_eq!(req.headers.len(), 1);
1282 assert_eq!(req.headers[0].name, "Host");
1283 assert_eq!(req.headers[0].value, b"example.com");
1284 }
1285}
1286
1287
1288req! {
1289 urltest_092,
1290 b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
1291 |req| {
1292 assert_eq!(req.method.unwrap(), "GET");
1293 assert_eq!(req.path.unwrap(), "/foo/");
1294 assert_eq!(req.version.unwrap(), 1);
1295 assert_eq!(req.headers.len(), 1);
1296 assert_eq!(req.headers[0].name, "Host");
1297 assert_eq!(req.headers[0].value, b"example.com");
1298 }
1299}
1300
1301
1302req! {
1303 urltest_093,
1304 b"GET /foo/%2e%2 HTTP/1.1\r\nHost: example.com\r\n\r\n",
1305 |req| {
1306 assert_eq!(req.method.unwrap(), "GET");
1307 assert_eq!(req.path.unwrap(), "/foo/%2e%2");
1308 assert_eq!(req.version.unwrap(), 1);
1309 assert_eq!(req.headers.len(), 1);
1310 assert_eq!(req.headers[0].name, "Host");
1311 assert_eq!(req.headers[0].value, b"example.com");
1312 }
1313}
1314
1315
1316req! {
1317 urltest_094,
1318 b"GET /%2e.bar HTTP/1.1\r\nHost: example.com\r\n\r\n",
1319 |req| {
1320 assert_eq!(req.method.unwrap(), "GET");
1321 assert_eq!(req.path.unwrap(), "/%2e.bar");
1322 assert_eq!(req.version.unwrap(), 1);
1323 assert_eq!(req.headers.len(), 1);
1324 assert_eq!(req.headers[0].name, "Host");
1325 assert_eq!(req.headers[0].value, b"example.com");
1326 }
1327}
1328
1329
1330req! {
1331 urltest_095,
1332 b"GET // HTTP/1.1\r\nHost: example.com\r\n\r\n",
1333 |req| {
1334 assert_eq!(req.method.unwrap(), "GET");
1335 assert_eq!(req.path.unwrap(), "//");
1336 assert_eq!(req.version.unwrap(), 1);
1337 assert_eq!(req.headers.len(), 1);
1338 assert_eq!(req.headers[0].name, "Host");
1339 assert_eq!(req.headers[0].value, b"example.com");
1340 }
1341}
1342
1343
1344req! {
1345 urltest_096,
1346 b"GET /foo/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
1347 |req| {
1348 assert_eq!(req.method.unwrap(), "GET");
1349 assert_eq!(req.path.unwrap(), "/foo/");
1350 assert_eq!(req.version.unwrap(), 1);
1351 assert_eq!(req.headers.len(), 1);
1352 assert_eq!(req.headers[0].name, "Host");
1353 assert_eq!(req.headers[0].value, b"example.com");
1354 }
1355}
1356
1357
1358req! {
1359 urltest_097,
1360 b"GET /foo/bar/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
1361 |req| {
1362 assert_eq!(req.method.unwrap(), "GET");
1363 assert_eq!(req.path.unwrap(), "/foo/bar/");
1364 assert_eq!(req.version.unwrap(), 1);
1365 assert_eq!(req.headers.len(), 1);
1366 assert_eq!(req.headers[0].name, "Host");
1367 assert_eq!(req.headers[0].value, b"example.com");
1368 }
1369}
1370
1371
1372req! {
1373 urltest_098,
1374 b"GET /foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
1375 |req| {
1376 assert_eq!(req.method.unwrap(), "GET");
1377 assert_eq!(req.path.unwrap(), "/foo");
1378 assert_eq!(req.version.unwrap(), 1);
1379 assert_eq!(req.headers.len(), 1);
1380 assert_eq!(req.headers[0].name, "Host");
1381 assert_eq!(req.headers[0].value, b"example.com");
1382 }
1383}
1384
1385
1386req! {
1387 urltest_099,
1388 b"GET /%20foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
1389 |req| {
1390 assert_eq!(req.method.unwrap(), "GET");
1391 assert_eq!(req.path.unwrap(), "/%20foo");
1392 assert_eq!(req.version.unwrap(), 1);
1393 assert_eq!(req.headers.len(), 1);
1394 assert_eq!(req.headers[0].name, "Host");
1395 assert_eq!(req.headers[0].value, b"example.com");
1396 }
1397}
1398
1399
1400req! {
1401 urltest_100,
1402 b"GET /foo% HTTP/1.1\r\nHost: example.com\r\n\r\n",
1403 |req| {
1404 assert_eq!(req.method.unwrap(), "GET");
1405 assert_eq!(req.path.unwrap(), "/foo%");
1406 assert_eq!(req.version.unwrap(), 1);
1407 assert_eq!(req.headers.len(), 1);
1408 assert_eq!(req.headers[0].name, "Host");
1409 assert_eq!(req.headers[0].value, b"example.com");
1410 }
1411}
1412
1413
1414req! {
1415 urltest_101,
1416 b"GET /foo%2 HTTP/1.1\r\nHost: example.com\r\n\r\n",
1417 |req| {
1418 assert_eq!(req.method.unwrap(), "GET");
1419 assert_eq!(req.path.unwrap(), "/foo%2");
1420 assert_eq!(req.version.unwrap(), 1);
1421 assert_eq!(req.headers.len(), 1);
1422 assert_eq!(req.headers[0].name, "Host");
1423 assert_eq!(req.headers[0].value, b"example.com");
1424 }
1425}
1426
1427
1428req! {
1429 urltest_102,
1430 b"GET /foo%2zbar HTTP/1.1\r\nHost: example.com\r\n\r\n",
1431 |req| {
1432 assert_eq!(req.method.unwrap(), "GET");
1433 assert_eq!(req.path.unwrap(), "/foo%2zbar");
1434 assert_eq!(req.version.unwrap(), 1);
1435 assert_eq!(req.headers.len(), 1);
1436 assert_eq!(req.headers[0].name, "Host");
1437 assert_eq!(req.headers[0].value, b"example.com");
1438 }
1439}
1440
1441
1442req! {
1443 urltest_103,
1444 b"GET /foo%2%C3%82%C2%A9zbar HTTP/1.1\r\nHost: example.com\r\n\r\n",
1445 |req| {
1446 assert_eq!(req.method.unwrap(), "GET");
1447 assert_eq!(req.path.unwrap(), "/foo%2%C3%82%C2%A9zbar");
1448 assert_eq!(req.version.unwrap(), 1);
1449 assert_eq!(req.headers.len(), 1);
1450 assert_eq!(req.headers[0].name, "Host");
1451 assert_eq!(req.headers[0].value, b"example.com");
1452 }
1453}
1454
1455
1456req! {
1457 urltest_104,
1458 b"GET /foo%41%7a HTTP/1.1\r\nHost: example.com\r\n\r\n",
1459 |req| {
1460 assert_eq!(req.method.unwrap(), "GET");
1461 assert_eq!(req.path.unwrap(), "/foo%41%7a");
1462 assert_eq!(req.version.unwrap(), 1);
1463 assert_eq!(req.headers.len(), 1);
1464 assert_eq!(req.headers[0].name, "Host");
1465 assert_eq!(req.headers[0].value, b"example.com");
1466 }
1467}
1468
1469
1470req! {
1471 urltest_105,
1472 b"GET /foo%C2%91%91 HTTP/1.1\r\nHost: example.com\r\n\r\n",
1473 |req| {
1474 assert_eq!(req.method.unwrap(), "GET");
1475 assert_eq!(req.path.unwrap(), "/foo%C2%91%91");
1476 assert_eq!(req.version.unwrap(), 1);
1477 assert_eq!(req.headers.len(), 1);
1478 assert_eq!(req.headers[0].name, "Host");
1479 assert_eq!(req.headers[0].value, b"example.com");
1480 }
1481}
1482
1483
1484req! {
1485 urltest_106,
1486 b"GET /foo%00%51 HTTP/1.1\r\nHost: example.com\r\n\r\n",
1487 |req| {
1488 assert_eq!(req.method.unwrap(), "GET");
1489 assert_eq!(req.path.unwrap(), "/foo%00%51");
1490 assert_eq!(req.version.unwrap(), 1);
1491 assert_eq!(req.headers.len(), 1);
1492 assert_eq!(req.headers[0].name, "Host");
1493 assert_eq!(req.headers[0].value, b"example.com");
1494 }
1495}
1496
1497
1498req! {
1499 urltest_107,
1500 b"GET /(%28:%3A%29) HTTP/1.1\r\nHost: example.com\r\n\r\n",
1501 |req| {
1502 assert_eq!(req.method.unwrap(), "GET");
1503 assert_eq!(req.path.unwrap(), "/(%28:%3A%29)");
1504 assert_eq!(req.version.unwrap(), 1);
1505 assert_eq!(req.headers.len(), 1);
1506 assert_eq!(req.headers[0].name, "Host");
1507 assert_eq!(req.headers[0].value, b"example.com");
1508 }
1509}
1510
1511
1512req! {
1513 urltest_108,
1514 b"GET /%3A%3a%3C%3c HTTP/1.1\r\nHost: example.com\r\n\r\n",
1515 |req| {
1516 assert_eq!(req.method.unwrap(), "GET");
1517 assert_eq!(req.path.unwrap(), "/%3A%3a%3C%3c");
1518 assert_eq!(req.version.unwrap(), 1);
1519 assert_eq!(req.headers.len(), 1);
1520 assert_eq!(req.headers[0].name, "Host");
1521 assert_eq!(req.headers[0].value, b"example.com");
1522 }
1523}
1524
1525
1526req! {
1527 urltest_109,
1528 b"GET /foobar HTTP/1.1\r\nHost: example.com\r\n\r\n",
1529 |req| {
1530 assert_eq!(req.method.unwrap(), "GET");
1531 assert_eq!(req.path.unwrap(), "/foobar");
1532 assert_eq!(req.version.unwrap(), 1);
1533 assert_eq!(req.headers.len(), 1);
1534 assert_eq!(req.headers[0].name, "Host");
1535 assert_eq!(req.headers[0].value, b"example.com");
1536 }
1537}
1538
1539
1540req! {
1541 urltest_110,
1542 b"GET //foo//bar HTTP/1.1\r\nHost: example.com\r\n\r\n",
1543 |req| {
1544 assert_eq!(req.method.unwrap(), "GET");
1545 assert_eq!(req.path.unwrap(), "//foo//bar");
1546 assert_eq!(req.version.unwrap(), 1);
1547 assert_eq!(req.headers.len(), 1);
1548 assert_eq!(req.headers[0].name, "Host");
1549 assert_eq!(req.headers[0].value, b"example.com");
1550 }
1551}
1552
1553
1554req! {
1555 urltest_111,
1556 b"GET /%7Ffp3%3Eju%3Dduvgw%3Dd HTTP/1.1\r\nHost: example.com\r\n\r\n",
1557 |req| {
1558 assert_eq!(req.method.unwrap(), "GET");
1559 assert_eq!(req.path.unwrap(), "/%7Ffp3%3Eju%3Dduvgw%3Dd");
1560 assert_eq!(req.version.unwrap(), 1);
1561 assert_eq!(req.headers.len(), 1);
1562 assert_eq!(req.headers[0].name, "Host");
1563 assert_eq!(req.headers[0].value, b"example.com");
1564 }
1565}
1566
1567
1568req! {
1569 urltest_112,
1570 b"GET /@asdf%40 HTTP/1.1\r\nHost: example.com\r\n\r\n",
1571 |req| {
1572 assert_eq!(req.method.unwrap(), "GET");
1573 assert_eq!(req.path.unwrap(), "/@asdf%40");
1574 assert_eq!(req.version.unwrap(), 1);
1575 assert_eq!(req.headers.len(), 1);
1576 assert_eq!(req.headers[0].name, "Host");
1577 assert_eq!(req.headers[0].value, b"example.com");
1578 }
1579}
1580
1581
1582req! {
1583 urltest_113,
1584 b"GET /%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD HTTP/1.1\r\nHost: example.com\r\n\r\n",
1585 |req| {
1586 assert_eq!(req.method.unwrap(), "GET");
1587 assert_eq!(req.path.unwrap(), "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD");
1588 assert_eq!(req.version.unwrap(), 1);
1589 assert_eq!(req.headers.len(), 1);
1590 assert_eq!(req.headers[0].name, "Host");
1591 assert_eq!(req.headers[0].value, b"example.com");
1592 }
1593}
1594
1595
1596req! {
1597 urltest_114,
1598 b"GET /%E2%80%A5/foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
1599 |req| {
1600 assert_eq!(req.method.unwrap(), "GET");
1601 assert_eq!(req.path.unwrap(), "/%E2%80%A5/foo");
1602 assert_eq!(req.version.unwrap(), 1);
1603 assert_eq!(req.headers.len(), 1);
1604 assert_eq!(req.headers[0].name, "Host");
1605 assert_eq!(req.headers[0].value, b"example.com");
1606 }
1607}
1608
1609
1610req! {
1611 urltest_115,
1612 b"GET /%EF%BB%BF/foo HTTP/1.1\r\nHost: example.com\r\n\r\n",
1613 |req| {
1614 assert_eq!(req.method.unwrap(), "GET");
1615 assert_eq!(req.path.unwrap(), "/%EF%BB%BF/foo");
1616 assert_eq!(req.version.unwrap(), 1);
1617 assert_eq!(req.headers.len(), 1);
1618 assert_eq!(req.headers[0].name, "Host");
1619 assert_eq!(req.headers[0].value, b"example.com");
1620 }
1621}
1622
1623
1624req! {
1625 urltest_116,
1626 b"GET /%E2%80%AE/foo/%E2%80%AD/bar HTTP/1.1\r\nHost: example.com\r\n\r\n",
1627 |req| {
1628 assert_eq!(req.method.unwrap(), "GET");
1629 assert_eq!(req.path.unwrap(), "/%E2%80%AE/foo/%E2%80%AD/bar");
1630 assert_eq!(req.version.unwrap(), 1);
1631 assert_eq!(req.headers.len(), 1);
1632 assert_eq!(req.headers[0].name, "Host");
1633 assert_eq!(req.headers[0].value, b"example.com");
1634 }
1635}
1636
1637
1638req! {
1639 urltest_117,
1640 b"GET /foo?bar=baz HTTP/1.1\r\nHost: www.google.com\r\n\r\n",
1641 |req| {
1642 assert_eq!(req.method.unwrap(), "GET");
1643 assert_eq!(req.path.unwrap(), "/foo?bar=baz");
1644 assert_eq!(req.version.unwrap(), 1);
1645 assert_eq!(req.headers.len(), 1);
1646 assert_eq!(req.headers[0].name, "Host");
1647 assert_eq!(req.headers[0].value, b"www.google.com");
1648 }
1649}
1650
1651
1652req! {
1653 urltest_118,
1654 b"GET /foo?bar=baz HTTP/1.1\r\nHost: www.google.com\r\n\r\n",
1655 |req| {
1656 assert_eq!(req.method.unwrap(), "GET");
1657 assert_eq!(req.path.unwrap(), "/foo?bar=baz");
1658 assert_eq!(req.version.unwrap(), 1);
1659 assert_eq!(req.headers.len(), 1);
1660 assert_eq!(req.headers[0].name, "Host");
1661 assert_eq!(req.headers[0].value, b"www.google.com");
1662 }
1663}
1664
1665
1666req! {
1667 urltest_119,
1668 b"GET test HTTP/1.1\r\nHost: \r\n\r\n",
1669 |req| {
1670 assert_eq!(req.method.unwrap(), "GET");
1671 assert_eq!(req.path.unwrap(), "test");
1672 assert_eq!(req.version.unwrap(), 1);
1673 assert_eq!(req.headers.len(), 1);
1674 assert_eq!(req.headers[0].name, "Host");
1675 assert_eq!(req.headers[0].value, b"");
1676 }
1677}
1678
1679
1680req! {
1681 urltest_120,
1682 b"GET /foo%2Ehtml HTTP/1.1\r\nHost: www\r\n\r\n",
1683 |req| {
1684 assert_eq!(req.method.unwrap(), "GET");
1685 assert_eq!(req.path.unwrap(), "/foo%2Ehtml");
1686 assert_eq!(req.version.unwrap(), 1);
1687 assert_eq!(req.headers.len(), 1);
1688 assert_eq!(req.headers[0].name, "Host");
1689 assert_eq!(req.headers[0].value, b"www");
1690 }
1691}
1692
1693
1694req! {
1695 urltest_121,
1696 b"GET /foo/html HTTP/1.1\r\nHost: www\r\n\r\n",
1697 |req| {
1698 assert_eq!(req.method.unwrap(), "GET");
1699 assert_eq!(req.path.unwrap(), "/foo/html");
1700 assert_eq!(req.version.unwrap(), 1);
1701 assert_eq!(req.headers.len(), 1);
1702 assert_eq!(req.headers[0].name, "Host");
1703 assert_eq!(req.headers[0].value, b"www");
1704 }
1705}
1706
1707
1708req! {
1709 urltest_122,
1710 b"GET /foo HTTP/1.1\r\nHost: www.google.com\r\n\r\n",
1711 |req| {
1712 assert_eq!(req.method.unwrap(), "GET");
1713 assert_eq!(req.path.unwrap(), "/foo");
1714 assert_eq!(req.version.unwrap(), 1);
1715 assert_eq!(req.headers.len(), 1);
1716 assert_eq!(req.headers[0].name, "Host");
1717 assert_eq!(req.headers[0].value, b"www.google.com");
1718 }
1719}
1720
1721
1722req! {
1723 urltest_123,
1724 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1725 |req| {
1726 assert_eq!(req.method.unwrap(), "GET");
1727 assert_eq!(req.path.unwrap(), "/example.com/");
1728 assert_eq!(req.version.unwrap(), 1);
1729 assert_eq!(req.headers.len(), 1);
1730 assert_eq!(req.headers[0].name, "Host");
1731 assert_eq!(req.headers[0].value, b"");
1732 }
1733}
1734
1735
1736req! {
1737 urltest_124,
1738 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1739 |req| {
1740 assert_eq!(req.method.unwrap(), "GET");
1741 assert_eq!(req.path.unwrap(), "/example.com/");
1742 assert_eq!(req.version.unwrap(), 1);
1743 assert_eq!(req.headers.len(), 1);
1744 assert_eq!(req.headers[0].name, "Host");
1745 assert_eq!(req.headers[0].value, b"");
1746 }
1747}
1748
1749
1750req! {
1751 urltest_125,
1752 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1753 |req| {
1754 assert_eq!(req.method.unwrap(), "GET");
1755 assert_eq!(req.path.unwrap(), "/example.com/");
1756 assert_eq!(req.version.unwrap(), 1);
1757 assert_eq!(req.headers.len(), 1);
1758 assert_eq!(req.headers[0].name, "Host");
1759 assert_eq!(req.headers[0].value, b"");
1760 }
1761}
1762
1763
1764req! {
1765 urltest_126,
1766 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1767 |req| {
1768 assert_eq!(req.method.unwrap(), "GET");
1769 assert_eq!(req.path.unwrap(), "/example.com/");
1770 assert_eq!(req.version.unwrap(), 1);
1771 assert_eq!(req.headers.len(), 1);
1772 assert_eq!(req.headers[0].name, "Host");
1773 assert_eq!(req.headers[0].value, b"");
1774 }
1775}
1776
1777
1778req! {
1779 urltest_127,
1780 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1781 |req| {
1782 assert_eq!(req.method.unwrap(), "GET");
1783 assert_eq!(req.path.unwrap(), "/example.com/");
1784 assert_eq!(req.version.unwrap(), 1);
1785 assert_eq!(req.headers.len(), 1);
1786 assert_eq!(req.headers[0].name, "Host");
1787 assert_eq!(req.headers[0].value, b"");
1788 }
1789}
1790
1791
1792req! {
1793 urltest_128,
1794 b"GET /example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1795 |req| {
1796 assert_eq!(req.method.unwrap(), "GET");
1797 assert_eq!(req.path.unwrap(), "/example.com/");
1798 assert_eq!(req.version.unwrap(), 1);
1799 assert_eq!(req.headers.len(), 1);
1800 assert_eq!(req.headers[0].name, "Host");
1801 assert_eq!(req.headers[0].value, b"");
1802 }
1803}
1804
1805
1806req! {
1807 urltest_129,
1808 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1809 |req| {
1810 assert_eq!(req.method.unwrap(), "GET");
1811 assert_eq!(req.path.unwrap(), "example.com/");
1812 assert_eq!(req.version.unwrap(), 1);
1813 assert_eq!(req.headers.len(), 1);
1814 assert_eq!(req.headers[0].name, "Host");
1815 assert_eq!(req.headers[0].value, b"");
1816 }
1817}
1818
1819
1820req! {
1821 urltest_130,
1822 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1823 |req| {
1824 assert_eq!(req.method.unwrap(), "GET");
1825 assert_eq!(req.path.unwrap(), "example.com/");
1826 assert_eq!(req.version.unwrap(), 1);
1827 assert_eq!(req.headers.len(), 1);
1828 assert_eq!(req.headers[0].name, "Host");
1829 assert_eq!(req.headers[0].value, b"");
1830 }
1831}
1832
1833
1834req! {
1835 urltest_131,
1836 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1837 |req| {
1838 assert_eq!(req.method.unwrap(), "GET");
1839 assert_eq!(req.path.unwrap(), "example.com/");
1840 assert_eq!(req.version.unwrap(), 1);
1841 assert_eq!(req.headers.len(), 1);
1842 assert_eq!(req.headers[0].name, "Host");
1843 assert_eq!(req.headers[0].value, b"");
1844 }
1845}
1846
1847
1848req! {
1849 urltest_132,
1850 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1851 |req| {
1852 assert_eq!(req.method.unwrap(), "GET");
1853 assert_eq!(req.path.unwrap(), "example.com/");
1854 assert_eq!(req.version.unwrap(), 1);
1855 assert_eq!(req.headers.len(), 1);
1856 assert_eq!(req.headers[0].name, "Host");
1857 assert_eq!(req.headers[0].value, b"");
1858 }
1859}
1860
1861
1862req! {
1863 urltest_133,
1864 b"GET example.com/ HTTP/1.1\r\nHost: \r\n\r\n",
1865 |req| {
1866 assert_eq!(req.method.unwrap(), "GET");
1867 assert_eq!(req.path.unwrap(), "example.com/");
1868 assert_eq!(req.version.unwrap(), 1);
1869 assert_eq!(req.headers.len(), 1);
1870 assert_eq!(req.headers[0].name, "Host");
1871 assert_eq!(req.headers[0].value, b"");
1872 }
1873}
1874
1875
1876req! {
1877 urltest_134,
1878 b"GET /test.txt HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
1879 |req| {
1880 assert_eq!(req.method.unwrap(), "GET");
1881 assert_eq!(req.path.unwrap(), "/test.txt");
1882 assert_eq!(req.version.unwrap(), 1);
1883 assert_eq!(req.headers.len(), 1);
1884 assert_eq!(req.headers[0].name, "Host");
1885 assert_eq!(req.headers[0].value, b"www.example.com");
1886 }
1887}
1888
1889
1890req! {
1891 urltest_135,
1892 b"GET /test.txt HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
1893 |req| {
1894 assert_eq!(req.method.unwrap(), "GET");
1895 assert_eq!(req.path.unwrap(), "/test.txt");
1896 assert_eq!(req.version.unwrap(), 1);
1897 assert_eq!(req.headers.len(), 1);
1898 assert_eq!(req.headers[0].name, "Host");
1899 assert_eq!(req.headers[0].value, b"www.example.com");
1900 }
1901}
1902
1903
1904req! {
1905 urltest_136,
1906 b"GET /test.txt HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
1907 |req| {
1908 assert_eq!(req.method.unwrap(), "GET");
1909 assert_eq!(req.path.unwrap(), "/test.txt");
1910 assert_eq!(req.version.unwrap(), 1);
1911 assert_eq!(req.headers.len(), 1);
1912 assert_eq!(req.headers[0].name, "Host");
1913 assert_eq!(req.headers[0].value, b"www.example.com");
1914 }
1915}
1916
1917
1918req! {
1919 urltest_137,
1920 b"GET /test.txt HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
1921 |req| {
1922 assert_eq!(req.method.unwrap(), "GET");
1923 assert_eq!(req.path.unwrap(), "/test.txt");
1924 assert_eq!(req.version.unwrap(), 1);
1925 assert_eq!(req.headers.len(), 1);
1926 assert_eq!(req.headers[0].name, "Host");
1927 assert_eq!(req.headers[0].value, b"www.example.com");
1928 }
1929}
1930
1931
1932req! {
1933 urltest_138,
1934 b"GET /aaa/test.txt HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
1935 |req| {
1936 assert_eq!(req.method.unwrap(), "GET");
1937 assert_eq!(req.path.unwrap(), "/aaa/test.txt");
1938 assert_eq!(req.version.unwrap(), 1);
1939 assert_eq!(req.headers.len(), 1);
1940 assert_eq!(req.headers[0].name, "Host");
1941 assert_eq!(req.headers[0].value, b"www.example.com");
1942 }
1943}
1944
1945
1946req! {
1947 urltest_139,
1948 b"GET /test.txt HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
1949 |req| {
1950 assert_eq!(req.method.unwrap(), "GET");
1951 assert_eq!(req.path.unwrap(), "/test.txt");
1952 assert_eq!(req.version.unwrap(), 1);
1953 assert_eq!(req.headers.len(), 1);
1954 assert_eq!(req.headers[0].name, "Host");
1955 assert_eq!(req.headers[0].value, b"www.example.com");
1956 }
1957}
1958
1959
1960req! {
1961 urltest_140,
1962 b"GET /%E4%B8%AD/test.txt HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
1963 |req| {
1964 assert_eq!(req.method.unwrap(), "GET");
1965 assert_eq!(req.path.unwrap(), "/%E4%B8%AD/test.txt");
1966 assert_eq!(req.version.unwrap(), 1);
1967 assert_eq!(req.headers.len(), 1);
1968 assert_eq!(req.headers[0].name, "Host");
1969 assert_eq!(req.headers[0].value, b"www.example.com");
1970 }
1971}
1972
1973
1974req! {
1975 urltest_141,
1976 b"GET /... HTTP/1.1\r\nHost: \r\n\r\n",
1977 |req| {
1978 assert_eq!(req.method.unwrap(), "GET");
1979 assert_eq!(req.path.unwrap(), "/...");
1980 assert_eq!(req.version.unwrap(), 1);
1981 assert_eq!(req.headers.len(), 1);
1982 assert_eq!(req.headers[0].name, "Host");
1983 assert_eq!(req.headers[0].value, b"");
1984 }
1985}
1986
1987
1988req! {
1989 urltest_142,
1990 b"GET /a HTTP/1.1\r\nHost: \r\n\r\n",
1991 |req| {
1992 assert_eq!(req.method.unwrap(), "GET");
1993 assert_eq!(req.path.unwrap(), "/a");
1994 assert_eq!(req.version.unwrap(), 1);
1995 assert_eq!(req.headers.len(), 1);
1996 assert_eq!(req.headers[0].name, "Host");
1997 assert_eq!(req.headers[0].value, b"");
1998 }
1999}
2000
2001
2002req! {
2003 urltest_143,
2004 b"GET /%EF%BF%BD?%EF%BF%BD HTTP/1.1\r\nHost: x\r\n\r\n",
2005 |req| {
2006 assert_eq!(req.method.unwrap(), "GET");
2007 assert_eq!(req.path.unwrap(), "/%EF%BF%BD?%EF%BF%BD");
2008 assert_eq!(req.version.unwrap(), 1);
2009 assert_eq!(req.headers.len(), 1);
2010 assert_eq!(req.headers[0].name, "Host");
2011 assert_eq!(req.headers[0].value, b"x");
2012 }
2013}
2014
2015
2016req! {
2017 urltest_144,
2018 b"GET /bar HTTP/1.1\r\nHost: example.com\r\n\r\n",
2019 |req| {
2020 assert_eq!(req.method.unwrap(), "GET");
2021 assert_eq!(req.path.unwrap(), "/bar");
2022 assert_eq!(req.version.unwrap(), 1);
2023 assert_eq!(req.headers.len(), 1);
2024 assert_eq!(req.headers[0].name, "Host");
2025 assert_eq!(req.headers[0].value, b"example.com");
2026 }
2027}
2028
2029
2030req! {
2031 urltest_145,
2032 b"GET test HTTP/1.1\r\nHost: \r\n\r\n",
2033 |req| {
2034 assert_eq!(req.method.unwrap(), "GET");
2035 assert_eq!(req.path.unwrap(), "test");
2036 assert_eq!(req.version.unwrap(), 1);
2037 assert_eq!(req.headers.len(), 1);
2038 assert_eq!(req.headers[0].name, "Host");
2039 assert_eq!(req.headers[0].value, b"");
2040 }
2041}
2042
2043
2044req! {
2045 urltest_146,
2046 b"GET x@x.com HTTP/1.1\r\nHost: \r\n\r\n",
2047 |req| {
2048 assert_eq!(req.method.unwrap(), "GET");
2049 assert_eq!(req.path.unwrap(), "x@x.com");
2050 assert_eq!(req.version.unwrap(), 1);
2051 assert_eq!(req.headers.len(), 1);
2052 assert_eq!(req.headers[0].name, "Host");
2053 assert_eq!(req.headers[0].value, b"");
2054 }
2055}
2056
2057
2058req! {
2059 urltest_147,
2060 b"GET , HTTP/1.1\r\nHost: \r\n\r\n",
2061 |req| {
2062 assert_eq!(req.method.unwrap(), "GET");
2063 assert_eq!(req.path.unwrap(), ",");
2064 assert_eq!(req.version.unwrap(), 1);
2065 assert_eq!(req.headers.len(), 1);
2066 assert_eq!(req.headers[0].name, "Host");
2067 assert_eq!(req.headers[0].value, b"");
2068 }
2069}
2070
2071
2072req! {
2073 urltest_148,
2074 b"GET blank HTTP/1.1\r\nHost: \r\n\r\n",
2075 |req| {
2076 assert_eq!(req.method.unwrap(), "GET");
2077 assert_eq!(req.path.unwrap(), "blank");
2078 assert_eq!(req.version.unwrap(), 1);
2079 assert_eq!(req.headers.len(), 1);
2080 assert_eq!(req.headers[0].name, "Host");
2081 assert_eq!(req.headers[0].value, b"");
2082 }
2083}
2084
2085
2086req! {
2087 urltest_149,
2088 b"GET test?test HTTP/1.1\r\nHost: \r\n\r\n",
2089 |req| {
2090 assert_eq!(req.method.unwrap(), "GET");
2091 assert_eq!(req.path.unwrap(), "test?test");
2092 assert_eq!(req.version.unwrap(), 1);
2093 assert_eq!(req.headers.len(), 1);
2094 assert_eq!(req.headers[0].name, "Host");
2095 assert_eq!(req.headers[0].value, b"");
2096 }
2097}
2098
2099
2100req! {
2101 urltest_150,
2102 b"GET /%60%7B%7D?`{} HTTP/1.1\r\nHost: h\r\n\r\n",
2103 |req| {
2104 assert_eq!(req.method.unwrap(), "GET");
2105 assert_eq!(req.path.unwrap(), "/%60%7B%7D?`{}");
2106 assert_eq!(req.version.unwrap(), 1);
2107 assert_eq!(req.headers.len(), 1);
2108 assert_eq!(req.headers[0].name, "Host");
2109 assert_eq!(req.headers[0].value, b"h");
2110 }
2111
2112}
2113
2114
2115req! {
2116 urltest_151,
2117 b"GET /?%27 HTTP/1.1\r\nHost: host\r\n\r\n",
2118 |req| {
2119 assert_eq!(req.method.unwrap(), "GET");
2120 assert_eq!(req.path.unwrap(), "/?%27");
2121 assert_eq!(req.version.unwrap(), 1);
2122 assert_eq!(req.headers.len(), 1);
2123 assert_eq!(req.headers[0].name, "Host");
2124 assert_eq!(req.headers[0].value, b"host");
2125 }
2126}
2127
2128
2129req! {
2130 urltest_152,
2131 b"GET /?' HTTP/1.1\r\nHost: host\r\n\r\n",
2132 |req| {
2133 assert_eq!(req.method.unwrap(), "GET");
2134 assert_eq!(req.path.unwrap(), "/?'");
2135 assert_eq!(req.version.unwrap(), 1);
2136 assert_eq!(req.headers.len(), 1);
2137 assert_eq!(req.headers[0].name, "Host");
2138 assert_eq!(req.headers[0].value, b"host");
2139 }
2140}
2141
2142
2143req! {
2144 urltest_153,
2145 b"GET /some/path HTTP/1.1\r\nHost: example.org\r\n\r\n",
2146 |req| {
2147 assert_eq!(req.method.unwrap(), "GET");
2148 assert_eq!(req.path.unwrap(), "/some/path");
2149 assert_eq!(req.version.unwrap(), 1);
2150 assert_eq!(req.headers.len(), 1);
2151 assert_eq!(req.headers[0].name, "Host");
2152 assert_eq!(req.headers[0].value, b"example.org");
2153 }
2154}
2155
2156
2157req! {
2158 urltest_154,
2159 b"GET /smth HTTP/1.1\r\nHost: example.org\r\n\r\n",
2160 |req| {
2161 assert_eq!(req.method.unwrap(), "GET");
2162 assert_eq!(req.path.unwrap(), "/smth");
2163 assert_eq!(req.version.unwrap(), 1);
2164 assert_eq!(req.headers.len(), 1);
2165 assert_eq!(req.headers[0].name, "Host");
2166 assert_eq!(req.headers[0].value, b"example.org");
2167 }
2168}
2169
2170
2171req! {
2172 urltest_155,
2173 b"GET /some/path HTTP/1.1\r\nHost: example.org\r\n\r\n",
2174 |req| {
2175 assert_eq!(req.method.unwrap(), "GET");
2176 assert_eq!(req.path.unwrap(), "/some/path");
2177 assert_eq!(req.version.unwrap(), 1);
2178 assert_eq!(req.headers.len(), 1);
2179 assert_eq!(req.headers[0].name, "Host");
2180 assert_eq!(req.headers[0].value, b"example.org");
2181 }
2182}
2183
2184
2185req! {
2186 urltest_156,
2187 b"GET /pa/i HTTP/1.1\r\nHost: \r\n\r\n",
2188 |req| {
2189 assert_eq!(req.method.unwrap(), "GET");
2190 assert_eq!(req.path.unwrap(), "/pa/i");
2191 assert_eq!(req.version.unwrap(), 1);
2192 assert_eq!(req.headers.len(), 1);
2193 assert_eq!(req.headers[0].name, "Host");
2194 assert_eq!(req.headers[0].value, b"");
2195 }
2196}
2197
2198
2199req! {
2200 urltest_157,
2201 b"GET /i HTTP/1.1\r\nHost: ho\r\n\r\n",
2202 |req| {
2203 assert_eq!(req.method.unwrap(), "GET");
2204 assert_eq!(req.path.unwrap(), "/i");
2205 assert_eq!(req.version.unwrap(), 1);
2206 assert_eq!(req.headers.len(), 1);
2207 assert_eq!(req.headers[0].name, "Host");
2208 assert_eq!(req.headers[0].value, b"ho");
2209 }
2210}
2211
2212
2213req! {
2214 urltest_158,
2215 b"GET /pa/i HTTP/1.1\r\nHost: \r\n\r\n",
2216 |req| {
2217 assert_eq!(req.method.unwrap(), "GET");
2218 assert_eq!(req.path.unwrap(), "/pa/i");
2219 assert_eq!(req.version.unwrap(), 1);
2220 assert_eq!(req.headers.len(), 1);
2221 assert_eq!(req.headers[0].name, "Host");
2222 assert_eq!(req.headers[0].value, b"");
2223 }
2224}
2225
2226
2227req! {
2228 urltest_159,
2229 b"GET /i HTTP/1.1\r\nHost: \r\n\r\n",
2230 |req| {
2231 assert_eq!(req.method.unwrap(), "GET");
2232 assert_eq!(req.path.unwrap(), "/i");
2233 assert_eq!(req.version.unwrap(), 1);
2234 assert_eq!(req.headers.len(), 1);
2235 assert_eq!(req.headers[0].name, "Host");
2236 assert_eq!(req.headers[0].value, b"");
2237 }
2238}
2239
2240
2241req! {
2242 urltest_160,
2243 b"GET /i HTTP/1.1\r\nHost: ho\r\n\r\n",
2244 |req| {
2245 assert_eq!(req.method.unwrap(), "GET");
2246 assert_eq!(req.path.unwrap(), "/i");
2247 assert_eq!(req.version.unwrap(), 1);
2248 assert_eq!(req.headers.len(), 1);
2249 assert_eq!(req.headers[0].name, "Host");
2250 assert_eq!(req.headers[0].value, b"ho");
2251 }
2252}
2253
2254
2255req! {
2256 urltest_161,
2257 b"GET /i HTTP/1.1\r\nHost: \r\n\r\n",
2258 |req| {
2259 assert_eq!(req.method.unwrap(), "GET");
2260 assert_eq!(req.path.unwrap(), "/i");
2261 assert_eq!(req.version.unwrap(), 1);
2262 assert_eq!(req.headers.len(), 1);
2263 assert_eq!(req.headers[0].name, "Host");
2264 assert_eq!(req.headers[0].value, b"");
2265 }
2266}
2267
2268
2269req! {
2270 urltest_162,
2271 b"GET /i HTTP/1.1\r\nHost: \r\n\r\n",
2272 |req| {
2273 assert_eq!(req.method.unwrap(), "GET");
2274 assert_eq!(req.path.unwrap(), "/i");
2275 assert_eq!(req.version.unwrap(), 1);
2276 assert_eq!(req.headers.len(), 1);
2277 assert_eq!(req.headers[0].name, "Host");
2278 assert_eq!(req.headers[0].value, b"");
2279 }
2280}
2281
2282
2283req! {
2284 urltest_163,
2285 b"GET /i HTTP/1.1\r\nHost: ho\r\n\r\n",
2286 |req| {
2287 assert_eq!(req.method.unwrap(), "GET");
2288 assert_eq!(req.path.unwrap(), "/i");
2289 assert_eq!(req.version.unwrap(), 1);
2290 assert_eq!(req.headers.len(), 1);
2291 assert_eq!(req.headers[0].name, "Host");
2292 assert_eq!(req.headers[0].value, b"ho");
2293 }
2294}
2295
2296
2297req! {
2298 urltest_164,
2299 b"GET /i HTTP/1.1\r\nHost: \r\n\r\n",
2300 |req| {
2301 assert_eq!(req.method.unwrap(), "GET");
2302 assert_eq!(req.path.unwrap(), "/i");
2303 assert_eq!(req.version.unwrap(), 1);
2304 assert_eq!(req.headers.len(), 1);
2305 assert_eq!(req.headers[0].name, "Host");
2306 assert_eq!(req.headers[0].value, b"");
2307 }
2308}
2309
2310
2311req! {
2312 urltest_165,
2313 b"GET /pa/pa?i HTTP/1.1\r\nHost: \r\n\r\n",
2314 |req| {
2315 assert_eq!(req.method.unwrap(), "GET");
2316 assert_eq!(req.path.unwrap(), "/pa/pa?i");
2317 assert_eq!(req.version.unwrap(), 1);
2318 assert_eq!(req.headers.len(), 1);
2319 assert_eq!(req.headers[0].name, "Host");
2320 assert_eq!(req.headers[0].value, b"");
2321 }
2322}
2323
2324
2325req! {
2326 urltest_166,
2327 b"GET /pa?i HTTP/1.1\r\nHost: ho\r\n\r\n",
2328 |req| {
2329 assert_eq!(req.method.unwrap(), "GET");
2330 assert_eq!(req.path.unwrap(), "/pa?i");
2331 assert_eq!(req.version.unwrap(), 1);
2332 assert_eq!(req.headers.len(), 1);
2333 assert_eq!(req.headers[0].name, "Host");
2334 assert_eq!(req.headers[0].value, b"ho");
2335 }
2336}
2337
2338
2339req! {
2340 urltest_167,
2341 b"GET /pa/pa?i HTTP/1.1\r\nHost: \r\n\r\n",
2342 |req| {
2343 assert_eq!(req.method.unwrap(), "GET");
2344 assert_eq!(req.path.unwrap(), "/pa/pa?i");
2345 assert_eq!(req.version.unwrap(), 1);
2346 assert_eq!(req.headers.len(), 1);
2347 assert_eq!(req.headers[0].name, "Host");
2348 assert_eq!(req.headers[0].value, b"");
2349 }
2350}
2351
2352
2353req! {
2354 urltest_168,
2355 b"GET sd HTTP/1.1\r\nHost: \r\n\r\n",
2356 |req| {
2357 assert_eq!(req.method.unwrap(), "GET");
2358 assert_eq!(req.path.unwrap(), "sd");
2359 assert_eq!(req.version.unwrap(), 1);
2360 assert_eq!(req.headers.len(), 1);
2361 assert_eq!(req.headers[0].name, "Host");
2362 assert_eq!(req.headers[0].value, b"");
2363 }
2364}
2365
2366
2367req! {
2368 urltest_169,
2369 b"GET sd/sd HTTP/1.1\r\nHost: \r\n\r\n",
2370 |req| {
2371 assert_eq!(req.method.unwrap(), "GET");
2372 assert_eq!(req.path.unwrap(), "sd/sd");
2373 assert_eq!(req.version.unwrap(), 1);
2374 assert_eq!(req.headers.len(), 1);
2375 assert_eq!(req.headers[0].name, "Host");
2376 assert_eq!(req.headers[0].value, b"");
2377 }
2378}
2379
2380
2381req! {
2382 urltest_170,
2383 b"GET /pa/pa HTTP/1.1\r\nHost: \r\n\r\n",
2384 |req| {
2385 assert_eq!(req.method.unwrap(), "GET");
2386 assert_eq!(req.path.unwrap(), "/pa/pa");
2387 assert_eq!(req.version.unwrap(), 1);
2388 assert_eq!(req.headers.len(), 1);
2389 assert_eq!(req.headers[0].name, "Host");
2390 assert_eq!(req.headers[0].value, b"");
2391 }
2392}
2393
2394
2395req! {
2396 urltest_171,
2397 b"GET /pa HTTP/1.1\r\nHost: ho\r\n\r\n",
2398 |req| {
2399 assert_eq!(req.method.unwrap(), "GET");
2400 assert_eq!(req.path.unwrap(), "/pa");
2401 assert_eq!(req.version.unwrap(), 1);
2402 assert_eq!(req.headers.len(), 1);
2403 assert_eq!(req.headers[0].name, "Host");
2404 assert_eq!(req.headers[0].value, b"ho");
2405 }
2406}
2407
2408
2409req! {
2410 urltest_172,
2411 b"GET /pa/pa HTTP/1.1\r\nHost: \r\n\r\n",
2412 |req| {
2413 assert_eq!(req.method.unwrap(), "GET");
2414 assert_eq!(req.path.unwrap(), "/pa/pa");
2415 assert_eq!(req.version.unwrap(), 1);
2416 assert_eq!(req.headers.len(), 1);
2417 assert_eq!(req.headers[0].name, "Host");
2418 assert_eq!(req.headers[0].value, b"");
2419 }
2420}
2421
2422
2423req! {
2424 urltest_173,
2425 b"GET /x HTTP/1.1\r\nHost: %C3%B1\r\n\r\n",
2426 |req| {
2427 assert_eq!(req.method.unwrap(), "GET");
2428 assert_eq!(req.path.unwrap(), "/x");
2429 assert_eq!(req.version.unwrap(), 1);
2430 assert_eq!(req.headers.len(), 1);
2431 assert_eq!(req.headers[0].name, "Host");
2432 assert_eq!(req.headers[0].value, b"%C3%B1");
2433 }
2434}
2435
2436
2437req! {
2438 urltest_174,
2439 b"GET \\.\\./ HTTP/1.1\r\n\r\n",
2440 |req| {
2441 assert_eq!(req.method.unwrap(), "GET");
2442 assert_eq!(req.path.unwrap(), "\\.\\./");
2443 assert_eq!(req.version.unwrap(), 1);
2444 assert_eq!(req.headers.len(), 0);
2445 }
2446}
2447
2448
2449req! {
2450 urltest_175,
2451 b"GET :a@example.net HTTP/1.1\r\nHost: \r\n\r\n",
2452 |req| {
2453 assert_eq!(req.method.unwrap(), "GET");
2454 assert_eq!(req.path.unwrap(), ":a@example.net");
2455 assert_eq!(req.version.unwrap(), 1);
2456 assert_eq!(req.headers.len(), 1);
2457 assert_eq!(req.headers[0].name, "Host");
2458 assert_eq!(req.headers[0].value, b"");
2459 }
2460}
2461
2462
2463req! {
2464 urltest_176,
2465 b"GET %NBD HTTP/1.1\r\nHost: \r\n\r\n",
2466 |req| {
2467 assert_eq!(req.method.unwrap(), "GET");
2468 assert_eq!(req.path.unwrap(), "%NBD");
2469 assert_eq!(req.version.unwrap(), 1);
2470 assert_eq!(req.headers.len(), 1);
2471 assert_eq!(req.headers[0].name, "Host");
2472 assert_eq!(req.headers[0].value, b"");
2473 }
2474}
2475
2476
2477req! {
2478 urltest_177,
2479 b"GET %1G HTTP/1.1\r\nHost: \r\n\r\n",
2480 |req| {
2481 assert_eq!(req.method.unwrap(), "GET");
2482 assert_eq!(req.path.unwrap(), "%1G");
2483 assert_eq!(req.version.unwrap(), 1);
2484 assert_eq!(req.headers.len(), 1);
2485 assert_eq!(req.headers[0].name, "Host");
2486 assert_eq!(req.headers[0].value, b"");
2487 }
2488}
2489
2490
2491req! {
2492 urltest_178,
2493 b"GET /relative_import.html HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n",
2494 |req| {
2495 assert_eq!(req.method.unwrap(), "GET");
2496 assert_eq!(req.path.unwrap(), "/relative_import.html");
2497 assert_eq!(req.version.unwrap(), 1);
2498 assert_eq!(req.headers.len(), 1);
2499 assert_eq!(req.headers[0].name, "Host");
2500 assert_eq!(req.headers[0].value, b"127.0.0.1");
2501 }
2502}
2503
2504
2505req! {
2506 urltest_179,
2507 b"GET /?foo=%7B%22abc%22 HTTP/1.1\r\nHost: facebook.com\r\n\r\n",
2508 |req| {
2509 assert_eq!(req.method.unwrap(), "GET");
2510 assert_eq!(req.path.unwrap(), "/?foo=%7B%22abc%22");
2511 assert_eq!(req.version.unwrap(), 1);
2512 assert_eq!(req.headers.len(), 1);
2513 assert_eq!(req.headers[0].name, "Host");
2514 assert_eq!(req.headers[0].value, b"facebook.com");
2515 }
2516}
2517
2518
2519req! {
2520 urltest_180,
2521 b"GET /jqueryui@1.2.3 HTTP/1.1\r\nHost: localhost\r\n\r\n",
2522 |req| {
2523 assert_eq!(req.method.unwrap(), "GET");
2524 assert_eq!(req.path.unwrap(), "/jqueryui@1.2.3");
2525 assert_eq!(req.version.unwrap(), 1);
2526 assert_eq!(req.headers.len(), 1);
2527 assert_eq!(req.headers[0].name, "Host");
2528 assert_eq!(req.headers[0].value, b"localhost");
2529 }
2530}
2531
2532
2533req! {
2534 urltest_181,
2535 b"GET /path?query HTTP/1.1\r\nHost: host\r\n\r\n",
2536 |req| {
2537 assert_eq!(req.method.unwrap(), "GET");
2538 assert_eq!(req.path.unwrap(), "/path?query");
2539 assert_eq!(req.version.unwrap(), 1);
2540 assert_eq!(req.headers.len(), 1);
2541 assert_eq!(req.headers[0].name, "Host");
2542 assert_eq!(req.headers[0].value, b"host");
2543 }
2544}
2545
2546
2547req! {
2548 urltest_182,
2549 b"GET /foo/bar?a=b&c=d HTTP/1.1\r\nHost: example.org\r\n\r\n",
2550 |req| {
2551 assert_eq!(req.method.unwrap(), "GET");
2552 assert_eq!(req.path.unwrap(), "/foo/bar?a=b&c=d");
2553 assert_eq!(req.version.unwrap(), 1);
2554 assert_eq!(req.headers.len(), 1);
2555 assert_eq!(req.headers[0].name, "Host");
2556 assert_eq!(req.headers[0].value, b"example.org");
2557 }
2558}
2559
2560
2561req! {
2562 urltest_183,
2563 b"GET /foo/bar??a=b&c=d HTTP/1.1\r\nHost: example.org\r\n\r\n",
2564 |req| {
2565 assert_eq!(req.method.unwrap(), "GET");
2566 assert_eq!(req.path.unwrap(), "/foo/bar??a=b&c=d");
2567 assert_eq!(req.version.unwrap(), 1);
2568 assert_eq!(req.headers.len(), 1);
2569 assert_eq!(req.headers[0].name, "Host");
2570 assert_eq!(req.headers[0].value, b"example.org");
2571 }
2572}
2573
2574
2575req! {
2576 urltest_184,
2577 b"GET /foo/bar HTTP/1.1\r\nHost: example.org\r\n\r\n",
2578 |req| {
2579 assert_eq!(req.method.unwrap(), "GET");
2580 assert_eq!(req.path.unwrap(), "/foo/bar");
2581 assert_eq!(req.version.unwrap(), 1);
2582 assert_eq!(req.headers.len(), 1);
2583 assert_eq!(req.headers[0].name, "Host");
2584 assert_eq!(req.headers[0].value, b"example.org");
2585 }
2586}
2587
2588
2589req! {
2590 urltest_185,
2591 b"GET /baz?qux HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
2592 |req| {
2593 assert_eq!(req.method.unwrap(), "GET");
2594 assert_eq!(req.path.unwrap(), "/baz?qux");
2595 assert_eq!(req.version.unwrap(), 1);
2596 assert_eq!(req.headers.len(), 1);
2597 assert_eq!(req.headers[0].name, "Host");
2598 assert_eq!(req.headers[0].value, b"foo.bar");
2599 }
2600}
2601
2602
2603req! {
2604 urltest_186,
2605 b"GET /baz?qux HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
2606 |req| {
2607 assert_eq!(req.method.unwrap(), "GET");
2608 assert_eq!(req.path.unwrap(), "/baz?qux");
2609 assert_eq!(req.version.unwrap(), 1);
2610 assert_eq!(req.headers.len(), 1);
2611 assert_eq!(req.headers[0].name, "Host");
2612 assert_eq!(req.headers[0].value, b"foo.bar");
2613 }
2614}
2615
2616
2617req! {
2618 urltest_187,
2619 b"GET /baz?qux HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
2620 |req| {
2621 assert_eq!(req.method.unwrap(), "GET");
2622 assert_eq!(req.path.unwrap(), "/baz?qux");
2623 assert_eq!(req.version.unwrap(), 1);
2624 assert_eq!(req.headers.len(), 1);
2625 assert_eq!(req.headers[0].name, "Host");
2626 assert_eq!(req.headers[0].value, b"foo.bar");
2627 }
2628}
2629
2630
2631req! {
2632 urltest_188,
2633 b"GET /baz?qux HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
2634 |req| {
2635 assert_eq!(req.method.unwrap(), "GET");
2636 assert_eq!(req.path.unwrap(), "/baz?qux");
2637 assert_eq!(req.version.unwrap(), 1);
2638 assert_eq!(req.headers.len(), 1);
2639 assert_eq!(req.headers[0].name, "Host");
2640 assert_eq!(req.headers[0].value, b"foo.bar");
2641 }
2642}
2643
2644
2645req! {
2646 urltest_189,
2647 b"GET /baz?qux HTTP/1.1\r\nHost: foo.bar\r\n\r\n",
2648 |req| {
2649 assert_eq!(req.method.unwrap(), "GET");
2650 assert_eq!(req.path.unwrap(), "/baz?qux");
2651 assert_eq!(req.version.unwrap(), 1);
2652 assert_eq!(req.headers.len(), 1);
2653 assert_eq!(req.headers[0].name, "Host");
2654 assert_eq!(req.headers[0].value, b"foo.bar");
2655 }
2656}
2657
2658
2659req! {
2660 urltest_190,
2661 b"GET /C%3A/ HTTP/1.1\r\nHost: \r\n\r\n",
2662 |req| {
2663 assert_eq!(req.method.unwrap(), "GET");
2664 assert_eq!(req.path.unwrap(), "/C%3A/");
2665 assert_eq!(req.version.unwrap(), 1);
2666 assert_eq!(req.headers.len(), 1);
2667 assert_eq!(req.headers[0].name, "Host");
2668 assert_eq!(req.headers[0].value, b"");
2669 }
2670}
2671
2672
2673req! {
2674 urltest_191,
2675 b"GET /C%7C/ HTTP/1.1\r\nHost: \r\n\r\n",
2676 |req| {
2677 assert_eq!(req.method.unwrap(), "GET");
2678 assert_eq!(req.path.unwrap(), "/C%7C/");
2679 assert_eq!(req.version.unwrap(), 1);
2680 assert_eq!(req.headers.len(), 1);
2681 assert_eq!(req.headers[0].name, "Host");
2682 assert_eq!(req.headers[0].value, b"");
2683 }
2684}
2685
2686
2687req! {
2688 urltest_192,
2689 b"GET /C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif HTTP/1.1\r\nHost: \r\n\r\n",
2690 |req| {
2691 assert_eq!(req.method.unwrap(), "GET");
2692 assert_eq!(req.path.unwrap(), "/C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif");
2693 assert_eq!(req.version.unwrap(), 1);
2694 assert_eq!(req.headers.len(), 1);
2695 assert_eq!(req.headers[0].name, "Host");
2696 assert_eq!(req.headers[0].value, b"");
2697 }
2698}
2699
2700
2701req! {
2702 urltest_193,
2703 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
2704 |req| {
2705 assert_eq!(req.method.unwrap(), "GET");
2706 assert_eq!(req.path.unwrap(), "/C:/");
2707 assert_eq!(req.version.unwrap(), 1);
2708 assert_eq!(req.headers.len(), 1);
2709 assert_eq!(req.headers[0].name, "Host");
2710 assert_eq!(req.headers[0].value, b"");
2711 }
2712}
2713
2714
2715req! {
2716 urltest_194,
2717 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
2718 |req| {
2719 assert_eq!(req.method.unwrap(), "GET");
2720 assert_eq!(req.path.unwrap(), "/C:/");
2721 assert_eq!(req.version.unwrap(), 1);
2722 assert_eq!(req.headers.len(), 1);
2723 assert_eq!(req.headers[0].name, "Host");
2724 assert_eq!(req.headers[0].value, b"");
2725 }
2726}
2727
2728
2729req! {
2730 urltest_195,
2731 b"GET /d: HTTP/1.1\r\nHost: \r\n\r\n",
2732 |req| {
2733 assert_eq!(req.method.unwrap(), "GET");
2734 assert_eq!(req.path.unwrap(), "/d:");
2735 assert_eq!(req.version.unwrap(), 1);
2736 assert_eq!(req.headers.len(), 1);
2737 assert_eq!(req.headers[0].name, "Host");
2738 assert_eq!(req.headers[0].value, b"");
2739 }
2740}
2741
2742
2743req! {
2744 urltest_196,
2745 b"GET /d:/ HTTP/1.1\r\nHost: \r\n\r\n",
2746 |req| {
2747 assert_eq!(req.method.unwrap(), "GET");
2748 assert_eq!(req.path.unwrap(), "/d:/");
2749 assert_eq!(req.version.unwrap(), 1);
2750 assert_eq!(req.headers.len(), 1);
2751 assert_eq!(req.headers[0].name, "Host");
2752 assert_eq!(req.headers[0].value, b"");
2753 }
2754}
2755
2756
2757req! {
2758 urltest_197,
2759 b"GET /test?test HTTP/1.1\r\nHost: \r\n\r\n",
2760 |req| {
2761 assert_eq!(req.method.unwrap(), "GET");
2762 assert_eq!(req.path.unwrap(), "/test?test");
2763 assert_eq!(req.version.unwrap(), 1);
2764 assert_eq!(req.headers.len(), 1);
2765 assert_eq!(req.headers[0].name, "Host");
2766 assert_eq!(req.headers[0].value, b"");
2767 }
2768}
2769
2770
2771req! {
2772 urltest_198,
2773 b"GET /test?test HTTP/1.1\r\nHost: \r\n\r\n",
2774 |req| {
2775 assert_eq!(req.method.unwrap(), "GET");
2776 assert_eq!(req.path.unwrap(), "/test?test");
2777 assert_eq!(req.version.unwrap(), 1);
2778 assert_eq!(req.headers.len(), 1);
2779 assert_eq!(req.headers[0].name, "Host");
2780 assert_eq!(req.headers[0].value, b"");
2781 }
2782}
2783
2784
2785req! {
2786 urltest_199,
2787 b"GET /test?x HTTP/1.1\r\nHost: \r\n\r\n",
2788 |req| {
2789 assert_eq!(req.method.unwrap(), "GET");
2790 assert_eq!(req.path.unwrap(), "/test?x");
2791 assert_eq!(req.version.unwrap(), 1);
2792 assert_eq!(req.headers.len(), 1);
2793 assert_eq!(req.headers[0].name, "Host");
2794 assert_eq!(req.headers[0].value, b"");
2795 }
2796}
2797
2798
2799req! {
2800 urltest_200,
2801 b"GET /test?x HTTP/1.1\r\nHost: \r\n\r\n",
2802 |req| {
2803 assert_eq!(req.method.unwrap(), "GET");
2804 assert_eq!(req.path.unwrap(), "/test?x");
2805 assert_eq!(req.version.unwrap(), 1);
2806 assert_eq!(req.headers.len(), 1);
2807 assert_eq!(req.headers[0].name, "Host");
2808 assert_eq!(req.headers[0].value, b"");
2809 }
2810}
2811
2812
2813req! {
2814 urltest_201,
2815 b"GET /test?test HTTP/1.1\r\nHost: \r\n\r\n",
2816 |req| {
2817 assert_eq!(req.method.unwrap(), "GET");
2818 assert_eq!(req.path.unwrap(), "/test?test");
2819 assert_eq!(req.version.unwrap(), 1);
2820 assert_eq!(req.headers.len(), 1);
2821 assert_eq!(req.headers[0].name, "Host");
2822 assert_eq!(req.headers[0].value, b"");
2823 }
2824}
2825
2826
2827req! {
2828 urltest_202,
2829 b"GET /test?test HTTP/1.1\r\nHost: \r\n\r\n",
2830 |req| {
2831 assert_eq!(req.method.unwrap(), "GET");
2832 assert_eq!(req.path.unwrap(), "/test?test");
2833 assert_eq!(req.version.unwrap(), 1);
2834 assert_eq!(req.headers.len(), 1);
2835 assert_eq!(req.headers[0].name, "Host");
2836 assert_eq!(req.headers[0].value, b"");
2837 }
2838}
2839
2840
2841req! {
2842 urltest_203,
2843 b"GET /?fox HTTP/1.1\r\nHost: \r\n\r\n",
2844 |req| {
2845 assert_eq!(req.method.unwrap(), "GET");
2846 assert_eq!(req.path.unwrap(), "/?fox");
2847 assert_eq!(req.version.unwrap(), 1);
2848 assert_eq!(req.headers.len(), 1);
2849 assert_eq!(req.headers[0].name, "Host");
2850 assert_eq!(req.headers[0].value, b"");
2851 }
2852}
2853
2854
2855req! {
2856 urltest_204,
2857 b"GET /localhost//cat HTTP/1.1\r\nHost: \r\n\r\n",
2858 |req| {
2859 assert_eq!(req.method.unwrap(), "GET");
2860 assert_eq!(req.path.unwrap(), "/localhost//cat");
2861 assert_eq!(req.version.unwrap(), 1);
2862 assert_eq!(req.headers.len(), 1);
2863 assert_eq!(req.headers[0].name, "Host");
2864 assert_eq!(req.headers[0].value, b"");
2865 }
2866}
2867
2868
2869req! {
2870 urltest_205,
2871 b"GET /localhost//cat HTTP/1.1\r\nHost: \r\n\r\n",
2872 |req| {
2873 assert_eq!(req.method.unwrap(), "GET");
2874 assert_eq!(req.path.unwrap(), "/localhost//cat");
2875 assert_eq!(req.version.unwrap(), 1);
2876 assert_eq!(req.headers.len(), 1);
2877 assert_eq!(req.headers[0].name, "Host");
2878 assert_eq!(req.headers[0].value, b"");
2879 }
2880}
2881
2882
2883req! {
2884 urltest_206,
2885 b"GET /mouse HTTP/1.1\r\nHost: \r\n\r\n",
2886 |req| {
2887 assert_eq!(req.method.unwrap(), "GET");
2888 assert_eq!(req.path.unwrap(), "/mouse");
2889 assert_eq!(req.version.unwrap(), 1);
2890 assert_eq!(req.headers.len(), 1);
2891 assert_eq!(req.headers[0].name, "Host");
2892 assert_eq!(req.headers[0].value, b"");
2893 }
2894}
2895
2896
2897req! {
2898 urltest_207,
2899 b"GET /pig HTTP/1.1\r\nHost: \r\n\r\n",
2900 |req| {
2901 assert_eq!(req.method.unwrap(), "GET");
2902 assert_eq!(req.path.unwrap(), "/pig");
2903 assert_eq!(req.version.unwrap(), 1);
2904 assert_eq!(req.headers.len(), 1);
2905 assert_eq!(req.headers[0].name, "Host");
2906 assert_eq!(req.headers[0].value, b"");
2907 }
2908}
2909
2910
2911req! {
2912 urltest_208,
2913 b"GET /pig HTTP/1.1\r\nHost: \r\n\r\n",
2914 |req| {
2915 assert_eq!(req.method.unwrap(), "GET");
2916 assert_eq!(req.path.unwrap(), "/pig");
2917 assert_eq!(req.version.unwrap(), 1);
2918 assert_eq!(req.headers.len(), 1);
2919 assert_eq!(req.headers[0].name, "Host");
2920 assert_eq!(req.headers[0].value, b"");
2921 }
2922}
2923
2924
2925req! {
2926 urltest_209,
2927 b"GET /pig HTTP/1.1\r\nHost: \r\n\r\n",
2928 |req| {
2929 assert_eq!(req.method.unwrap(), "GET");
2930 assert_eq!(req.path.unwrap(), "/pig");
2931 assert_eq!(req.version.unwrap(), 1);
2932 assert_eq!(req.headers.len(), 1);
2933 assert_eq!(req.headers[0].name, "Host");
2934 assert_eq!(req.headers[0].value, b"");
2935 }
2936}
2937
2938
2939req! {
2940 urltest_210,
2941 b"GET /localhost//pig HTTP/1.1\r\nHost: lion\r\n\r\n",
2942 |req| {
2943 assert_eq!(req.method.unwrap(), "GET");
2944 assert_eq!(req.path.unwrap(), "/localhost//pig");
2945 assert_eq!(req.version.unwrap(), 1);
2946 assert_eq!(req.headers.len(), 1);
2947 assert_eq!(req.headers[0].name, "Host");
2948 assert_eq!(req.headers[0].value, b"lion");
2949 }
2950}
2951
2952
2953req! {
2954 urltest_211,
2955 b"GET /rooibos HTTP/1.1\r\nHost: tea\r\n\r\n",
2956 |req| {
2957 assert_eq!(req.method.unwrap(), "GET");
2958 assert_eq!(req.path.unwrap(), "/rooibos");
2959 assert_eq!(req.version.unwrap(), 1);
2960 assert_eq!(req.headers.len(), 1);
2961 assert_eq!(req.headers[0].name, "Host");
2962 assert_eq!(req.headers[0].value, b"tea");
2963 }
2964}
2965
2966
2967req! {
2968 urltest_212,
2969 b"GET /?chai HTTP/1.1\r\nHost: tea\r\n\r\n",
2970 |req| {
2971 assert_eq!(req.method.unwrap(), "GET");
2972 assert_eq!(req.path.unwrap(), "/?chai");
2973 assert_eq!(req.version.unwrap(), 1);
2974 assert_eq!(req.headers.len(), 1);
2975 assert_eq!(req.headers[0].name, "Host");
2976 assert_eq!(req.headers[0].value, b"tea");
2977 }
2978}
2979
2980
2981req! {
2982 urltest_213,
2983 b"GET /C: HTTP/1.1\r\nHost: \r\n\r\n",
2984 |req| {
2985 assert_eq!(req.method.unwrap(), "GET");
2986 assert_eq!(req.path.unwrap(), "/C:");
2987 assert_eq!(req.version.unwrap(), 1);
2988 assert_eq!(req.headers.len(), 1);
2989 assert_eq!(req.headers[0].name, "Host");
2990 assert_eq!(req.headers[0].value, b"");
2991 }
2992}
2993
2994
2995req! {
2996 urltest_214,
2997 b"GET /C: HTTP/1.1\r\nHost: \r\n\r\n",
2998 |req| {
2999 assert_eq!(req.method.unwrap(), "GET");
3000 assert_eq!(req.path.unwrap(), "/C:");
3001 assert_eq!(req.version.unwrap(), 1);
3002 assert_eq!(req.headers.len(), 1);
3003 assert_eq!(req.headers[0].name, "Host");
3004 assert_eq!(req.headers[0].value, b"");
3005 }
3006}
3007
3008
3009req! {
3010 urltest_215,
3011 b"GET /C: HTTP/1.1\r\nHost: \r\n\r\n",
3012 |req| {
3013 assert_eq!(req.method.unwrap(), "GET");
3014 assert_eq!(req.path.unwrap(), "/C:");
3015 assert_eq!(req.version.unwrap(), 1);
3016 assert_eq!(req.headers.len(), 1);
3017 assert_eq!(req.headers[0].name, "Host");
3018 assert_eq!(req.headers[0].value, b"");
3019 }
3020}
3021
3022
3023req! {
3024 urltest_216,
3025 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3026 |req| {
3027 assert_eq!(req.method.unwrap(), "GET");
3028 assert_eq!(req.path.unwrap(), "/C:/");
3029 assert_eq!(req.version.unwrap(), 1);
3030 assert_eq!(req.headers.len(), 1);
3031 assert_eq!(req.headers[0].name, "Host");
3032 assert_eq!(req.headers[0].value, b"");
3033 }
3034}
3035
3036
3037req! {
3038 urltest_217,
3039 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3040 |req| {
3041 assert_eq!(req.method.unwrap(), "GET");
3042 assert_eq!(req.path.unwrap(), "/C:/");
3043 assert_eq!(req.version.unwrap(), 1);
3044 assert_eq!(req.headers.len(), 1);
3045 assert_eq!(req.headers[0].name, "Host");
3046 assert_eq!(req.headers[0].value, b"");
3047 }
3048}
3049
3050
3051req! {
3052 urltest_218,
3053 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3054 |req| {
3055 assert_eq!(req.method.unwrap(), "GET");
3056 assert_eq!(req.path.unwrap(), "/C:/");
3057 assert_eq!(req.version.unwrap(), 1);
3058 assert_eq!(req.headers.len(), 1);
3059 assert_eq!(req.headers[0].name, "Host");
3060 assert_eq!(req.headers[0].value, b"");
3061 }
3062}
3063
3064
3065req! {
3066 urltest_219,
3067 b"GET /dir/C HTTP/1.1\r\nHost: host\r\n\r\n",
3068 |req| {
3069 assert_eq!(req.method.unwrap(), "GET");
3070 assert_eq!(req.path.unwrap(), "/dir/C");
3071 assert_eq!(req.version.unwrap(), 1);
3072 assert_eq!(req.headers.len(), 1);
3073 assert_eq!(req.headers[0].name, "Host");
3074 assert_eq!(req.headers[0].value, b"host");
3075 }
3076}
3077
3078
3079req! {
3080 urltest_220,
3081 b"GET /dir/C|a HTTP/1.1\r\nHost: host\r\n\r\n",
3082 |req| {
3083 assert_eq!(req.method.unwrap(), "GET");
3084 assert_eq!(req.path.unwrap(), "/dir/C|a");
3085 assert_eq!(req.version.unwrap(), 1);
3086 assert_eq!(req.headers.len(), 1);
3087 assert_eq!(req.headers[0].name, "Host");
3088 assert_eq!(req.headers[0].value, b"host");
3089 }
3090}
3091
3092
3093req! {
3094 urltest_221,
3095 b"GET /c:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
3096 |req| {
3097 assert_eq!(req.method.unwrap(), "GET");
3098 assert_eq!(req.path.unwrap(), "/c:/foo/bar");
3099 assert_eq!(req.version.unwrap(), 1);
3100 assert_eq!(req.headers.len(), 1);
3101 assert_eq!(req.headers[0].name, "Host");
3102 assert_eq!(req.headers[0].value, b"");
3103 }
3104}
3105
3106
3107req! {
3108 urltest_222,
3109 b"GET /c:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
3110 |req| {
3111 assert_eq!(req.method.unwrap(), "GET");
3112 assert_eq!(req.path.unwrap(), "/c:/foo/bar");
3113 assert_eq!(req.version.unwrap(), 1);
3114 assert_eq!(req.headers.len(), 1);
3115 assert_eq!(req.headers[0].name, "Host");
3116 assert_eq!(req.headers[0].value, b"");
3117 }
3118}
3119
3120
3121req! {
3122 urltest_223,
3123 b"GET /c:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
3124 |req| {
3125 assert_eq!(req.method.unwrap(), "GET");
3126 assert_eq!(req.path.unwrap(), "/c:/foo/bar");
3127 assert_eq!(req.version.unwrap(), 1);
3128 assert_eq!(req.headers.len(), 1);
3129 assert_eq!(req.headers[0].name, "Host");
3130 assert_eq!(req.headers[0].value, b"");
3131 }
3132}
3133
3134
3135req! {
3136 urltest_224,
3137 b"GET /c:/foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
3138 |req| {
3139 assert_eq!(req.method.unwrap(), "GET");
3140 assert_eq!(req.path.unwrap(), "/c:/foo/bar");
3141 assert_eq!(req.version.unwrap(), 1);
3142 assert_eq!(req.headers.len(), 1);
3143 assert_eq!(req.headers[0].name, "Host");
3144 assert_eq!(req.headers[0].value, b"");
3145 }
3146}
3147
3148
3149req! {
3150 urltest_225,
3151 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3152 |req| {
3153 assert_eq!(req.method.unwrap(), "GET");
3154 assert_eq!(req.path.unwrap(), "/C:/");
3155 assert_eq!(req.version.unwrap(), 1);
3156 assert_eq!(req.headers.len(), 1);
3157 assert_eq!(req.headers[0].name, "Host");
3158 assert_eq!(req.headers[0].value, b"");
3159 }
3160}
3161
3162
3163req! {
3164 urltest_226,
3165 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3166 |req| {
3167 assert_eq!(req.method.unwrap(), "GET");
3168 assert_eq!(req.path.unwrap(), "/C:/");
3169 assert_eq!(req.version.unwrap(), 1);
3170 assert_eq!(req.headers.len(), 1);
3171 assert_eq!(req.headers[0].name, "Host");
3172 assert_eq!(req.headers[0].value, b"");
3173 }
3174}
3175
3176
3177req! {
3178 urltest_227,
3179 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3180 |req| {
3181 assert_eq!(req.method.unwrap(), "GET");
3182 assert_eq!(req.path.unwrap(), "/C:/");
3183 assert_eq!(req.version.unwrap(), 1);
3184 assert_eq!(req.headers.len(), 1);
3185 assert_eq!(req.headers[0].name, "Host");
3186 assert_eq!(req.headers[0].value, b"");
3187 }
3188}
3189
3190
3191req! {
3192 urltest_228,
3193 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3194 |req| {
3195 assert_eq!(req.method.unwrap(), "GET");
3196 assert_eq!(req.path.unwrap(), "/C:/");
3197 assert_eq!(req.version.unwrap(), 1);
3198 assert_eq!(req.headers.len(), 1);
3199 assert_eq!(req.headers[0].name, "Host");
3200 assert_eq!(req.headers[0].value, b"");
3201 }
3202}
3203
3204
3205req! {
3206 urltest_229,
3207 b"GET /C:/ HTTP/1.1\r\nHost: \r\n\r\n",
3208 |req| {
3209 assert_eq!(req.method.unwrap(), "GET");
3210 assert_eq!(req.path.unwrap(), "/C:/");
3211 assert_eq!(req.version.unwrap(), 1);
3212 assert_eq!(req.headers.len(), 1);
3213 assert_eq!(req.headers[0].name, "Host");
3214 assert_eq!(req.headers[0].value, b"");
3215 }
3216}
3217
3218
3219req! {
3220 urltest_230,
3221 b"GET /?q=v HTTP/1.1\r\nHost: \r\n\r\n",
3222 |req| {
3223 assert_eq!(req.method.unwrap(), "GET");
3224 assert_eq!(req.path.unwrap(), "/?q=v");
3225 assert_eq!(req.version.unwrap(), 1);
3226 assert_eq!(req.headers.len(), 1);
3227 assert_eq!(req.headers[0].name, "Host");
3228 assert_eq!(req.headers[0].value, b"");
3229 }
3230}
3231
3232
3233req! {
3234 urltest_231,
3235 b"GET ?x HTTP/1.1\r\nHost: %C3%B1\r\n\r\n",
3236 |req| {
3237 assert_eq!(req.method.unwrap(), "GET");
3238 assert_eq!(req.path.unwrap(), "?x");
3239 assert_eq!(req.version.unwrap(), 1);
3240 assert_eq!(req.headers.len(), 1);
3241 assert_eq!(req.headers[0].name, "Host");
3242 assert_eq!(req.headers[0].value, b"%C3%B1");
3243 }
3244}
3245
3246
3247req! {
3248 urltest_232,
3249 b"GET ?x HTTP/1.1\r\nHost: %C3%B1\r\n\r\n",
3250 |req| {
3251 assert_eq!(req.method.unwrap(), "GET");
3252 assert_eq!(req.path.unwrap(), "?x");
3253 assert_eq!(req.version.unwrap(), 1);
3254 assert_eq!(req.headers.len(), 1);
3255 assert_eq!(req.headers[0].name, "Host");
3256 assert_eq!(req.headers[0].value, b"%C3%B1");
3257 }
3258}
3259
3260
3261req! {
3262 urltest_233,
3263 b"GET // HTTP/1.1\r\nHost: \r\n\r\n",
3264 |req| {
3265 assert_eq!(req.method.unwrap(), "GET");
3266 assert_eq!(req.path.unwrap(), "//");
3267 assert_eq!(req.version.unwrap(), 1);
3268 assert_eq!(req.headers.len(), 1);
3269 assert_eq!(req.headers[0].name, "Host");
3270 assert_eq!(req.headers[0].value, b"");
3271 }
3272}
3273
3274
3275req! {
3276 urltest_234,
3277 b"GET //x/ HTTP/1.1\r\nHost: \r\n\r\n",
3278 |req| {
3279 assert_eq!(req.method.unwrap(), "GET");
3280 assert_eq!(req.path.unwrap(), "//x/");
3281 assert_eq!(req.version.unwrap(), 1);
3282 assert_eq!(req.headers.len(), 1);
3283 assert_eq!(req.headers[0].name, "Host");
3284 assert_eq!(req.headers[0].value, b"");
3285 }
3286}
3287
3288
3289req! {
3290 urltest_235,
3291 b"GET /someconfig;mode=netascii HTTP/1.1\r\nHost: foobar.com\r\n\r\n",
3292 |req| {
3293 assert_eq!(req.method.unwrap(), "GET");
3294 assert_eq!(req.path.unwrap(), "/someconfig;mode=netascii");
3295 assert_eq!(req.version.unwrap(), 1);
3296 assert_eq!(req.headers.len(), 1);
3297 assert_eq!(req.headers[0].name, "Host");
3298 assert_eq!(req.headers[0].value, b"foobar.com");
3299 }
3300}
3301
3302
3303req! {
3304 urltest_236,
3305 b"GET /Index.ut2 HTTP/1.1\r\nHost: 10.10.10.10\r\n\r\n",
3306 |req| {
3307 assert_eq!(req.method.unwrap(), "GET");
3308 assert_eq!(req.path.unwrap(), "/Index.ut2");
3309 assert_eq!(req.version.unwrap(), 1);
3310 assert_eq!(req.headers.len(), 1);
3311 assert_eq!(req.headers[0].name, "Host");
3312 assert_eq!(req.headers[0].value, b"10.10.10.10");
3313 }
3314}
3315
3316
3317req! {
3318 urltest_237,
3319 b"GET /0?baz=bam&qux=baz HTTP/1.1\r\nHost: somehost\r\n\r\n",
3320 |req| {
3321 assert_eq!(req.method.unwrap(), "GET");
3322 assert_eq!(req.path.unwrap(), "/0?baz=bam&qux=baz");
3323 assert_eq!(req.version.unwrap(), 1);
3324 assert_eq!(req.headers.len(), 1);
3325 assert_eq!(req.headers[0].name, "Host");
3326 assert_eq!(req.headers[0].value, b"somehost");
3327 }
3328}
3329
3330
3331req! {
3332 urltest_238,
3333 b"GET /sup HTTP/1.1\r\nHost: host\r\n\r\n",
3334 |req| {
3335 assert_eq!(req.method.unwrap(), "GET");
3336 assert_eq!(req.path.unwrap(), "/sup");
3337 assert_eq!(req.version.unwrap(), 1);
3338 assert_eq!(req.headers.len(), 1);
3339 assert_eq!(req.headers[0].name, "Host");
3340 assert_eq!(req.headers[0].value, b"host");
3341 }
3342}
3343
3344
3345req! {
3346 urltest_239,
3347 b"GET /foo/bar.git HTTP/1.1\r\nHost: github.com\r\n\r\n",
3348 |req| {
3349 assert_eq!(req.method.unwrap(), "GET");
3350 assert_eq!(req.path.unwrap(), "/foo/bar.git");
3351 assert_eq!(req.version.unwrap(), 1);
3352 assert_eq!(req.headers.len(), 1);
3353 assert_eq!(req.headers[0].name, "Host");
3354 assert_eq!(req.headers[0].value, b"github.com");
3355 }
3356}
3357
3358
3359req! {
3360 urltest_240,
3361 b"GET /channel?passwd HTTP/1.1\r\nHost: myserver.com\r\n\r\n",
3362 |req| {
3363 assert_eq!(req.method.unwrap(), "GET");
3364 assert_eq!(req.path.unwrap(), "/channel?passwd");
3365 assert_eq!(req.version.unwrap(), 1);
3366 assert_eq!(req.headers.len(), 1);
3367 assert_eq!(req.headers[0].name, "Host");
3368 assert_eq!(req.headers[0].value, b"myserver.com");
3369 }
3370}
3371
3372
3373req! {
3374 urltest_241,
3375 b"GET /foo.bar.org?type=TXT HTTP/1.1\r\nHost: fw.example.org\r\n\r\n",
3376 |req| {
3377 assert_eq!(req.method.unwrap(), "GET");
3378 assert_eq!(req.path.unwrap(), "/foo.bar.org?type=TXT");
3379 assert_eq!(req.version.unwrap(), 1);
3380 assert_eq!(req.headers.len(), 1);
3381 assert_eq!(req.headers[0].name, "Host");
3382 assert_eq!(req.headers[0].value, b"fw.example.org");
3383 }
3384}
3385
3386
3387req! {
3388 urltest_242,
3389 b"GET /ou=People,o=JNDITutorial HTTP/1.1\r\nHost: localhost\r\n\r\n",
3390 |req| {
3391 assert_eq!(req.method.unwrap(), "GET");
3392 assert_eq!(req.path.unwrap(), "/ou=People,o=JNDITutorial");
3393 assert_eq!(req.version.unwrap(), 1);
3394 assert_eq!(req.headers.len(), 1);
3395 assert_eq!(req.headers[0].name, "Host");
3396 assert_eq!(req.headers[0].value, b"localhost");
3397 }
3398}
3399
3400
3401req! {
3402 urltest_243,
3403 b"GET /foo/bar HTTP/1.1\r\nHost: github.com\r\n\r\n",
3404 |req| {
3405 assert_eq!(req.method.unwrap(), "GET");
3406 assert_eq!(req.path.unwrap(), "/foo/bar");
3407 assert_eq!(req.version.unwrap(), 1);
3408 assert_eq!(req.headers.len(), 1);
3409 assert_eq!(req.headers[0].name, "Host");
3410 assert_eq!(req.headers[0].value, b"github.com");
3411 }
3412}
3413
3414
3415req! {
3416 urltest_244,
3417 b"GET ietf:rfc:2648 HTTP/1.1\r\nHost: \r\n\r\n",
3418 |req| {
3419 assert_eq!(req.method.unwrap(), "GET");
3420 assert_eq!(req.path.unwrap(), "ietf:rfc:2648");
3421 assert_eq!(req.version.unwrap(), 1);
3422 assert_eq!(req.headers.len(), 1);
3423 assert_eq!(req.headers[0].name, "Host");
3424 assert_eq!(req.headers[0].value, b"");
3425 }
3426}
3427
3428
3429req! {
3430 urltest_245,
3431 b"GET joe@example.org,2001:foo/bar HTTP/1.1\r\nHost: \r\n\r\n",
3432 |req| {
3433 assert_eq!(req.method.unwrap(), "GET");
3434 assert_eq!(req.path.unwrap(), "joe@example.org,2001:foo/bar");
3435 assert_eq!(req.version.unwrap(), 1);
3436 assert_eq!(req.headers.len(), 1);
3437 assert_eq!(req.headers[0].name, "Host");
3438 assert_eq!(req.headers[0].value, b"");
3439 }
3440}
3441
3442
3443req! {
3444 urltest_246,
3445 b"GET /path HTTP/1.1\r\nHost: H%4fSt\r\n\r\n",
3446 |req| {
3447 assert_eq!(req.method.unwrap(), "GET");
3448 assert_eq!(req.path.unwrap(), "/path");
3449 assert_eq!(req.version.unwrap(), 1);
3450 assert_eq!(req.headers.len(), 1);
3451 assert_eq!(req.headers[0].name, "Host");
3452 assert_eq!(req.headers[0].value, b"H%4fSt");
3453 }
3454}
3455
3456
3457req! {
3458 urltest_247,
3459 b"GET https://example.com:443/ HTTP/1.1\r\nHost: \r\n\r\n",
3460 |req| {
3461 assert_eq!(req.method.unwrap(), "GET");
3462 assert_eq!(req.path.unwrap(), "https://example.com:443/");
3463 assert_eq!(req.version.unwrap(), 1);
3464 assert_eq!(req.headers.len(), 1);
3465 assert_eq!(req.headers[0].name, "Host");
3466 assert_eq!(req.headers[0].value, b"");
3467 }
3468}
3469
3470
3471req! {
3472 urltest_248,
3473 b"GET d3958f5c-0777-0845-9dcf-2cb28783acaf HTTP/1.1\r\nHost: \r\n\r\n",
3474 |req| {
3475 assert_eq!(req.method.unwrap(), "GET");
3476 assert_eq!(req.path.unwrap(), "d3958f5c-0777-0845-9dcf-2cb28783acaf");
3477 assert_eq!(req.version.unwrap(), 1);
3478 assert_eq!(req.headers.len(), 1);
3479 assert_eq!(req.headers[0].name, "Host");
3480 assert_eq!(req.headers[0].value, b"");
3481 }
3482}
3483
3484
3485req! {
3486 urltest_249,
3487 b"GET /test?%22 HTTP/1.1\r\nHost: example.org\r\n\r\n",
3488 |req| {
3489 assert_eq!(req.method.unwrap(), "GET");
3490 assert_eq!(req.path.unwrap(), "/test?%22");
3491 assert_eq!(req.version.unwrap(), 1);
3492 assert_eq!(req.headers.len(), 1);
3493 assert_eq!(req.headers[0].name, "Host");
3494 assert_eq!(req.headers[0].value, b"example.org");
3495 }
3496}
3497
3498
3499req! {
3500 urltest_250,
3501 b"GET /test HTTP/1.1\r\nHost: example.org\r\n\r\n",
3502 |req| {
3503 assert_eq!(req.method.unwrap(), "GET");
3504 assert_eq!(req.path.unwrap(), "/test");
3505 assert_eq!(req.version.unwrap(), 1);
3506 assert_eq!(req.headers.len(), 1);
3507 assert_eq!(req.headers[0].name, "Host");
3508 assert_eq!(req.headers[0].value, b"example.org");
3509 }
3510}
3511
3512
3513req! {
3514 urltest_251,
3515 b"GET /test?%3C HTTP/1.1\r\nHost: example.org\r\n\r\n",
3516 |req| {
3517 assert_eq!(req.method.unwrap(), "GET");
3518 assert_eq!(req.path.unwrap(), "/test?%3C");
3519 assert_eq!(req.version.unwrap(), 1);
3520 assert_eq!(req.headers.len(), 1);
3521 assert_eq!(req.headers[0].name, "Host");
3522 assert_eq!(req.headers[0].value, b"example.org");
3523 }
3524}
3525
3526
3527req! {
3528 urltest_252,
3529 b"GET /test?%3E HTTP/1.1\r\nHost: example.org\r\n\r\n",
3530 |req| {
3531 assert_eq!(req.method.unwrap(), "GET");
3532 assert_eq!(req.path.unwrap(), "/test?%3E");
3533 assert_eq!(req.version.unwrap(), 1);
3534 assert_eq!(req.headers.len(), 1);
3535 assert_eq!(req.headers[0].name, "Host");
3536 assert_eq!(req.headers[0].value, b"example.org");
3537 }
3538}
3539
3540
3541req! {
3542 urltest_253,
3543 b"GET /test?%E2%8C%A3 HTTP/1.1\r\nHost: example.org\r\n\r\n",
3544 |req| {
3545 assert_eq!(req.method.unwrap(), "GET");
3546 assert_eq!(req.path.unwrap(), "/test?%E2%8C%A3");
3547 assert_eq!(req.version.unwrap(), 1);
3548 assert_eq!(req.headers.len(), 1);
3549 assert_eq!(req.headers[0].name, "Host");
3550 assert_eq!(req.headers[0].value, b"example.org");
3551 }
3552}
3553
3554
3555req! {
3556 urltest_254,
3557 b"GET /test?%23%23 HTTP/1.1\r\nHost: example.org\r\n\r\n",
3558 |req| {
3559 assert_eq!(req.method.unwrap(), "GET");
3560 assert_eq!(req.path.unwrap(), "/test?%23%23");
3561 assert_eq!(req.version.unwrap(), 1);
3562 assert_eq!(req.headers.len(), 1);
3563 assert_eq!(req.headers[0].name, "Host");
3564 assert_eq!(req.headers[0].value, b"example.org");
3565 }
3566}
3567
3568
3569req! {
3570 urltest_255,
3571 b"GET /test?%GH HTTP/1.1\r\nHost: example.org\r\n\r\n",
3572 |req| {
3573 assert_eq!(req.method.unwrap(), "GET");
3574 assert_eq!(req.path.unwrap(), "/test?%GH");
3575 assert_eq!(req.version.unwrap(), 1);
3576 assert_eq!(req.headers.len(), 1);
3577 assert_eq!(req.headers[0].name, "Host");
3578 assert_eq!(req.headers[0].value, b"example.org");
3579 }
3580}
3581
3582
3583req! {
3584 urltest_256,
3585 b"GET /test?a HTTP/1.1\r\nHost: example.org\r\n\r\n",
3586 |req| {
3587 assert_eq!(req.method.unwrap(), "GET");
3588 assert_eq!(req.path.unwrap(), "/test?a");
3589 assert_eq!(req.version.unwrap(), 1);
3590 assert_eq!(req.headers.len(), 1);
3591 assert_eq!(req.headers[0].name, "Host");
3592 assert_eq!(req.headers[0].value, b"example.org");
3593 }
3594}
3595
3596
3597req! {
3598 urltest_257,
3599 b"GET /test?a HTTP/1.1\r\nHost: example.org\r\n\r\n",
3600 |req| {
3601 assert_eq!(req.method.unwrap(), "GET");
3602 assert_eq!(req.path.unwrap(), "/test?a");
3603 assert_eq!(req.version.unwrap(), 1);
3604 assert_eq!(req.headers.len(), 1);
3605 assert_eq!(req.headers[0].name, "Host");
3606 assert_eq!(req.headers[0].value, b"example.org");
3607 }
3608}
3609
3610
3611req! {
3612 urltest_258,
3613 b"GET /test-a-colon-slash.html HTTP/1.1\r\nHost: \r\n\r\n",
3614 |req| {
3615 assert_eq!(req.method.unwrap(), "GET");
3616 assert_eq!(req.path.unwrap(), "/test-a-colon-slash.html");
3617 assert_eq!(req.version.unwrap(), 1);
3618 assert_eq!(req.headers.len(), 1);
3619 assert_eq!(req.headers[0].name, "Host");
3620 assert_eq!(req.headers[0].value, b"");
3621 }
3622}
3623
3624
3625req! {
3626 urltest_259,
3627 b"GET /test-a-colon-slash-slash.html HTTP/1.1\r\nHost: \r\n\r\n",
3628 |req| {
3629 assert_eq!(req.method.unwrap(), "GET");
3630 assert_eq!(req.path.unwrap(), "/test-a-colon-slash-slash.html");
3631 assert_eq!(req.version.unwrap(), 1);
3632 assert_eq!(req.headers.len(), 1);
3633 assert_eq!(req.headers[0].name, "Host");
3634 assert_eq!(req.headers[0].value, b"");
3635 }
3636}
3637
3638
3639req! {
3640 urltest_260,
3641 b"GET /test-a-colon-slash-b.html HTTP/1.1\r\nHost: \r\n\r\n",
3642 |req| {
3643 assert_eq!(req.method.unwrap(), "GET");
3644 assert_eq!(req.path.unwrap(), "/test-a-colon-slash-b.html");
3645 assert_eq!(req.version.unwrap(), 1);
3646 assert_eq!(req.headers.len(), 1);
3647 assert_eq!(req.headers[0].name, "Host");
3648 assert_eq!(req.headers[0].value, b"");
3649 }
3650}
3651
3652
3653req! {
3654 urltest_261,
3655 b"GET /test-a-colon-slash-slash-b.html HTTP/1.1\r\nHost: b\r\n\r\n",
3656 |req| {
3657 assert_eq!(req.method.unwrap(), "GET");
3658 assert_eq!(req.path.unwrap(), "/test-a-colon-slash-slash-b.html");
3659 assert_eq!(req.version.unwrap(), 1);
3660 assert_eq!(req.headers.len(), 1);
3661 assert_eq!(req.headers[0].name, "Host");
3662 assert_eq!(req.headers[0].value, b"b");
3663 }
3664}
3665
3666
3667req! {
3668 urltest_262,
3669 b"GET /test?a HTTP/1.1\r\nHost: example.org\r\n\r\n",
3670 |req| {
3671 assert_eq!(req.method.unwrap(), "GET");
3672 assert_eq!(req.path.unwrap(), "/test?a");
3673 assert_eq!(req.version.unwrap(), 1);
3674 assert_eq!(req.headers.len(), 1);
3675 assert_eq!(req.headers[0].name, "Host");
3676 assert_eq!(req.headers[0].value, b"example.org");
3677 }
3678}
3679
3680
3681req! {
3682 urltest_nvidia,
3683 b"GET /nvidia_web_services/controller.gfeclientcontent.php/com.nvidia.services.GFEClientContent.getShieldReady/{\"gcV\":\"2.2.2.0\",\"dID\":\"1341\",\"osC\":\"6.20\",\"is6\":\"1\",\"lg\":\"1033\",\"GFPV\":\"389.08\",\"isO\":\"1\",\"sM\":\"16777216\"} HTTP/1.0\r\nHost: gfwsl.geforce.com\r\n\r\n",
3684 |req| {
3685 assert_eq!(req.method.unwrap(), "GET");
3686 assert_eq!(req.path.unwrap(), "/nvidia_web_services/controller.gfeclientcontent.php/com.nvidia.services.GFEClientContent.getShieldReady/{\"gcV\":\"2.2.2.0\",\"dID\":\"1341\",\"osC\":\"6.20\",\"is6\":\"1\",\"lg\":\"1033\",\"GFPV\":\"389.08\",\"isO\":\"1\",\"sM\":\"16777216\"}");
3687 assert_eq!(req.version.unwrap(), 0);
3688 assert_eq!(req.headers.len(), 1);
3689 assert_eq!(req.headers[0].name, "Host");
3690 assert_eq!(req.headers[0].value, b"gfwsl.geforce.com");
3691 }
3692}
3693