blob: 909d5250942c7e3ae70b6a579bf6f02457584f3b [file] [log] [blame]
Christopher Faulet3f5fbe92022-07-05 14:50:17 +02001varnishtest "H1 authority validation and host normalizarion based on the scheme (rfc3982 6.3.2) or the method (connect)"
2
3feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.6-dev0)'"
4feature ignore_unknown_macro
5
Christopher Faulet725d5472023-06-19 19:00:52 +02006barrier b1 cond 2 -cyclic
7
Christopher Faulet3f5fbe92022-07-05 14:50:17 +02008syslog S1 -level info {
9 # C1
10 recv
11 expect ~ "^.* uri: GET http://toto:poue@hostname/c1 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020012 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020013
14 # C2
15 recv
16 expect ~ "^.* uri: GET http://hostname:8080/c2 HTTP/1.1; host: {hostname:8080}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020017 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020018
19 # C3
20 recv
21 expect ~ "^.* uri: GET https://hostname/c3 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020022 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020023
24 # C4
25 recv
26 expect ~ "^.* uri: GET https://hostname:80/c4 HTTP/1.1; host: {hostname:80}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020027 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020028
29 # C5
30 recv
Christopher Faulet1c521212022-11-22 15:39:12 +010031 expect ~ "^.* uri: CONNECT hostname:80 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020032 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020033 recv
Christopher Faulet1c521212022-11-22 15:39:12 +010034 expect ~ "^.* uri: CONNECT hostname:80 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020035 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010036 recv
37 expect ~ "^.* uri: CONNECT hostname:80 HTTP/1.1; host: {hostname:}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020038 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020039
40 # C6
41 recv
42 expect ~ "^.* uri: CONNECT hostname:443 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020043 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020044 recv
45 expect ~ "^.* uri: CONNECT hostname:443 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020046 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010047 recv
48 expect ~ "^.* uri: CONNECT hostname:443 HTTP/1.1; host: {hostname:}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020049 barrier b1 sync
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020050
Christopher Faulet1c521212022-11-22 15:39:12 +010051 # C7
Christopher Faulet3f5fbe92022-07-05 14:50:17 +020052 recv
53 expect ~ "^.* uri: CONNECT hostname:8443 HTTP/1.1; host: {hostname:8443}$"
Christopher Faulet725d5472023-06-19 19:00:52 +020054 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010055
56 # C8
57 recv
58 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020059 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010060
61 # C9
62 recv
63 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020064 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010065
66 # C10
67 recv
68 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020069 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010070
71 # C11
72 recv
73 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020074 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010075
76 # C12
77 recv
78 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020079 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010080
81 # C13
82 recv
83 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020084 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010085
86 # C14
87 recv
88 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020089 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010090
91 # C15
92 recv
93 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020094 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +010095
96 # C16
97 recv
98 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +020099 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100100
101 # C17
102 recv
Christopher Faulet725d5472023-06-19 19:00:52 +0200103 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100104 expect ~ "^.* uri: <BADREQ>; host: $"
105
106 # C18
107 recv
108 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +0200109 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100110
111 # C19
112 recv
113 expect ~ "^.* uri: <BADREQ>; host: $"
Christopher Faulet725d5472023-06-19 19:00:52 +0200114 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100115
116 # C20
117 recv
118 expect ~ "^.* uri: GET http://hostname/c20 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200119 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100120
121 # C21
122 recv
123 expect ~ "^.* uri: GET https://hostname/c21 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200124 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100125
126 # C22
127 recv
128 expect ~ "^.* uri: GET http://hostname/c22 HTTP/1.1; host: {hostname:80}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200129 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100130
131 # C23
132 recv
133 expect ~ "^.* uri: GET https://hostname/c23 HTTP/1.1; host: {hostname:443}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200134 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100135
136 # C24
137 recv
138 expect ~ "^.* uri: GET http://hostname/c24 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200139 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100140
141 # C25
142 recv
143 expect ~ "^.* uri: GET https://hostname/c25 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200144 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100145
146 # C26
147 recv
148 expect ~ "^.* uri: GET http://hostname/c26 HTTP/1.1; host: {hostname:}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200149 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100150
151 # C27
152 recv
153 expect ~ "^.* uri: GET https://hostname/c27 HTTP/1.1; host: {hostname:}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200154 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100155
156 # C28
157 recv
158 expect ~ "^.* uri: GET http://hostname/c28 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200159 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100160
161 # C29
162 recv
163 expect ~ "^.* uri: GET http://hostname/c29 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200164 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100165
166 # C30
167 recv
168 expect ~ "^.* uri: GET https://hostname/c30 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200169 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100170
171 # C31
172 recv
173 expect ~ "^.* uri: GET https://hostname/c31 HTTP/1.1; host: {hostname}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200174 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100175
176 # C32
177 recv
Christopher Faulet98b157e2024-05-24 15:59:35 +0200178 expect ~ "^.* uri: GET http:/// HTTP/1.1; host: {}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200179 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100180
181 # C33
182 recv
Christopher Faulet98b157e2024-05-24 15:59:35 +0200183 expect ~ "^.* uri: GET https:/// HTTP/1.1; host: {}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200184 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100185
186 # C34
187 recv
Christopher Faulet98b157e2024-05-24 15:59:35 +0200188 expect ~ "^.* uri: GET http:/// HTTP/1.1; host: {}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200189 barrier b1 sync
Christopher Faulet1c521212022-11-22 15:39:12 +0100190
191 # C35
192 recv
Christopher Faulet98b157e2024-05-24 15:59:35 +0200193 expect ~ "^.* uri: GET https:/// HTTP/1.1; host: {}$"
194 barrier b1 sync
195
196 # C36
197 recv
198 expect ~ "^.* uri: GET http://hostname/ HTTP/1.1; host: {hostname}$"
199 barrier b1 sync
200
201 # C37
202 recv
203 expect ~ "^.* uri: GET http://hostname/ HTTP/1.1; host: {hostname}$"
204 barrier b1 sync
205
206 # C38
207 recv
208 expect ~ "^.* uri: GET http://hostname/ HTTP/1.1; host: {hostname}$"
209 barrier b1 sync
210
211 # C39
212 recv
213 expect ~ "^.* uri: GET https://hostname/ HTTP/1.1; host: {hostname}$"
214 barrier b1 sync
215
216 # C40
217 recv
218 expect ~ "^.* uri: GET https://hostname/ HTTP/1.1; host: {hostname}$"
219 barrier b1 sync
220
221 # C41
222 recv
223 expect ~ "^.* uri: GET https://hostname/ HTTP/1.1; host: {hostname}$"
224 barrier b1 sync
225
226 # C42
227 recv
228 expect ~ "^.* uri: GET http://hostname:81/ HTTP/1.1; host: {hostname:81}$"
229 barrier b1 sync
230
231 # C43
232 recv
233 expect ~ "^.* uri: GET https://hostname:444/ HTTP/1.1; host: {hostname:444}$"
Christopher Faulet725d5472023-06-19 19:00:52 +0200234
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200235} -start
236
237haproxy h1 -conf {
238 defaults
239 mode http
240 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
241 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
242 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
243
244 frontend fe
245 bind "fd@${fe}"
246
247 http-request capture req.hdr(host) len 512
248 log-format "uri: %r; host: %hr"
249 log ${S1_addr}:${S1_port} len 2048 local0 debug err
250
251 http-request return status 200
252} -start
253
254# default port 80 with http scheme => should be normalized
255# Be sure userinfo are skipped
256client c1 -connect ${h1_fe_sock} {
257 txreq \
258 -req "GET" \
259 -url "http://toto:poue@hostname:80/c1" \
260 -hdr "host: hostname:80"
261
262 rxresp
263 expect resp.status == 200
264} -run
265
Christopher Faulet725d5472023-06-19 19:00:52 +0200266# Wait matching on log message
267barrier b1 sync
268
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200269# port 8080 with http scheme => no normalization
270client c2 -connect ${h1_fe_sock} {
271 txreq \
272 -req "GET" \
273 -url "http://hostname:8080/c2" \
274 -hdr "host: hostname:8080"
275
276 rxresp
277 expect resp.status == 200
278} -run
279
Christopher Faulet725d5472023-06-19 19:00:52 +0200280# Wait matching on log message
281barrier b1 sync
282
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200283# default port 443 with https scheme => should be normalized
284client c3 -connect ${h1_fe_sock} {
285 txreq \
286 -req "GET" \
287 -url "https://hostname:443/c3" \
288 -hdr "host: hostname:443"
289
290 rxresp
291 expect resp.status == 200
292} -run
293
Christopher Faulet725d5472023-06-19 19:00:52 +0200294# Wait matching on log message
295barrier b1 sync
296
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200297# port 80 with https scheme => no normalization
298client c4 -connect ${h1_fe_sock} {
299 txreq \
300 -req "GET" \
301 -url "https://hostname:80/c4" \
302 -hdr "host: hostname:80"
303
304 rxresp
305 expect resp.status == 200
306} -run
307
Christopher Faulet725d5472023-06-19 19:00:52 +0200308# Wait matching on log message
309barrier b1 sync
310
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200311# CONNECT on port 80 => should be normalized
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200312client c5 -connect ${h1_fe_sock} {
313 txreq \
314 -req "CONNECT" \
Christopher Faulet1c521212022-11-22 15:39:12 +0100315 -url "hostname:80" \
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200316 -hdr "host: hostname:80"
317
318 rxresp
319 expect resp.status == 200
320} -run
Christopher Faulet725d5472023-06-19 19:00:52 +0200321
322# Wait matching on log message
323barrier b1 sync
324
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200325client c5 -connect ${h1_fe_sock} {
326
327 txreq \
328 -req "CONNECT" \
Christopher Faulet1c521212022-11-22 15:39:12 +0100329 -url "hostname:80" \
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200330 -hdr "host: hostname"
331
332 rxresp
333 expect resp.status == 200
334} -run
Christopher Faulet725d5472023-06-19 19:00:52 +0200335
336# Wait matching on log message
337barrier b1 sync
338
Christopher Faulet1c521212022-11-22 15:39:12 +0100339client c5 -connect ${h1_fe_sock} {
340
341 txreq \
342 -req "CONNECT" \
343 -url "hostname:80" \
344 -hdr "host: hostname:"
345
346 rxresp
347 expect resp.status == 200
348} -run
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200349
Christopher Faulet725d5472023-06-19 19:00:52 +0200350# Wait matching on log message
351barrier b1 sync
352
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200353# CONNECT on port 443 => should be normalized
354client c6 -connect ${h1_fe_sock} {
355 txreq \
356 -req "CONNECT" \
357 -url "hostname:443" \
358 -hdr "host: hostname:443"
359
360 rxresp
361 expect resp.status == 200
362} -run
Christopher Faulet725d5472023-06-19 19:00:52 +0200363
364# Wait matching on log message
365barrier b1 sync
366
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200367client c6 -connect ${h1_fe_sock} {
368 txreq \
369 -req "CONNECT" \
370 -url "hostname:443" \
371 -hdr "host: hostname"
372
373 rxresp
374 expect resp.status == 200
375} -run
Christopher Faulet725d5472023-06-19 19:00:52 +0200376
377# Wait matching on log message
378barrier b1 sync
379
Christopher Faulet1c521212022-11-22 15:39:12 +0100380client c6 -connect ${h1_fe_sock} {
381 txreq \
382 -req "CONNECT" \
383 -url "hostname:443" \
384 -hdr "host: hostname:"
385
386 rxresp
387 expect resp.status == 200
388} -run
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200389
Christopher Faulet725d5472023-06-19 19:00:52 +0200390# Wait matching on log message
391barrier b1 sync
392
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200393# CONNECT on port non-default port => no normalization
394client c7 -connect ${h1_fe_sock} {
395 txreq \
396 -req "CONNECT" \
397 -url "hostname:8443" \
398 -hdr "host: hostname:8443"
399
400 rxresp
401 expect resp.status == 200
402} -run
403
Christopher Faulet725d5472023-06-19 19:00:52 +0200404# Wait matching on log message
405barrier b1 sync
406
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200407# host miss-match => error
408client c8 -connect ${h1_fe_sock} {
409 txreq \
410 -req "GET" \
411 -url "http://hostname1/" \
412 -hdr "host: hostname2"
413
414 rxresp
415 expect resp.status == 400
416} -run
417
Christopher Faulet725d5472023-06-19 19:00:52 +0200418# Wait matching on log message
419barrier b1 sync
420
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200421# port miss-match => error
422client c9 -connect ${h1_fe_sock} {
423 txreq \
424 -req "GET" \
425 -url "http://hostname:80/" \
426 -hdr "host: hostname:81"
427
428 rxresp
429 expect resp.status == 400
430} -run
431
Christopher Faulet725d5472023-06-19 19:00:52 +0200432# Wait matching on log message
433barrier b1 sync
434
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200435# no host port with a non-default port in abs-uri => error
436client c10 -connect ${h1_fe_sock} {
437 txreq \
438 -req "GET" \
439 -url "http://hostname:8080/" \
440 -hdr "host: hostname"
441
442 rxresp
443 expect resp.status == 400
444} -run
445
Christopher Faulet725d5472023-06-19 19:00:52 +0200446# Wait matching on log message
447barrier b1 sync
448
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200449# non-default host port with a default in abs-uri => error
450client c11 -connect ${h1_fe_sock} {
451 txreq \
452 -req "GET" \
453 -url "http://hostname/" \
454 -hdr "host: hostname:81"
455
456 rxresp
457 expect resp.status == 400
458} -run
459
Christopher Faulet725d5472023-06-19 19:00:52 +0200460# Wait matching on log message
461barrier b1 sync
462
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200463# miss-match between host headers => error
464client c12 -connect ${h1_fe_sock} {
465 txreq \
466 -req "GET" \
467 -url "http://hostname1/" \
468 -hdr "host: hostname1" \
469 -hdr "host: hostname2"
470
471 rxresp
472 expect resp.status == 400
473} -run
474
Christopher Faulet725d5472023-06-19 19:00:52 +0200475# Wait matching on log message
476barrier b1 sync
477
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200478# miss-match between host headers but with a normalization => error
479client c13 -connect ${h1_fe_sock} {
480 txreq \
481 -req "GET" \
482 -url "http://hostname1/" \
483 -hdr "host: hostname1:80" \
484 -hdr "host: hostname1"
485
486 rxresp
487 expect resp.status == 400
488} -run
489
Christopher Faulet725d5472023-06-19 19:00:52 +0200490# Wait matching on log message
491barrier b1 sync
492
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200493# CONNECT authoriy without port => error
494client c14 -connect ${h1_fe_sock} {
495 txreq \
496 -req "CONNECT" \
497 -url "hostname" \
498 -hdr "host: hostname"
499
500 rxresp
501 expect resp.status == 400
502} -run
503
Christopher Faulet725d5472023-06-19 19:00:52 +0200504# Wait matching on log message
505barrier b1 sync
506
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200507# host miss-match with CONNECT => error
508client c15 -connect ${h1_fe_sock} {
509 txreq \
510 -req "CONNECT" \
511 -url "hostname1:80" \
512 -hdr "host: hostname2:80"
513
514 rxresp
515 expect resp.status == 400
516} -run
517
Christopher Faulet725d5472023-06-19 19:00:52 +0200518# Wait matching on log message
519barrier b1 sync
520
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200521# port miss-match with CONNECT => error
522client c16 -connect ${h1_fe_sock} {
523 txreq \
524 -req "CONNECT" \
525 -url "hostname:80" \
526 -hdr "host: hostname:443"
527
528 rxresp
529 expect resp.status == 400
530} -run
531
Christopher Faulet725d5472023-06-19 19:00:52 +0200532# Wait matching on log message
533barrier b1 sync
534
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200535# no host port with non-default port in CONNECT authority => error
536client c17 -connect ${h1_fe_sock} {
537 txreq \
538 -req "CONNECT" \
539 -url "hostname:8080" \
540 -hdr "host: hostname"
541
542 rxresp
543 expect resp.status == 400
544} -run
545
Christopher Faulet725d5472023-06-19 19:00:52 +0200546# Wait matching on log message
547barrier b1 sync
548
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200549# no authority => error
550client c18 -connect ${h1_fe_sock} {
551 txreq \
552 -req "CONNECT" \
553 -url "/" \
554 -hdr "host: hostname"
555
556 rxresp
557 expect resp.status == 400
558} -run
559
Christopher Faulet725d5472023-06-19 19:00:52 +0200560# Wait matching on log message
561barrier b1 sync
562
Christopher Faulet1c521212022-11-22 15:39:12 +0100563# no authority => error
564client c19 -connect ${h1_fe_sock} {
565 txreq \
566 -req "CONNECT" \
567 -url "hostname:" \
568 -hdr "host: hostname"
569
570 rxresp
571 expect resp.status == 400
572} -run
573
Christopher Faulet725d5472023-06-19 19:00:52 +0200574# Wait matching on log message
575barrier b1 sync
576
Christopher Faulet1c521212022-11-22 15:39:12 +0100577
578# default port 80 with http scheme but no port for host value => should be normalized
579client c20 -connect ${h1_fe_sock} {
580 txreq \
581 -req "GET" \
582 -url "http://hostname:80/c20" \
583 -hdr "host: hostname"
584
585 rxresp
586 expect resp.status == 200
587} -run
588
Christopher Faulet725d5472023-06-19 19:00:52 +0200589# Wait matching on log message
590barrier b1 sync
591
Christopher Faulet1c521212022-11-22 15:39:12 +0100592
593# default port 443 with https scheme but no port for host value => should be normalized
594client c21 -connect ${h1_fe_sock} {
595 txreq \
596 -req "GET" \
597 -url "https://hostname:443/c21" \
598 -hdr "host: hostname"
599
600 rxresp
601 expect resp.status == 200
602} -run
603
Christopher Faulet725d5472023-06-19 19:00:52 +0200604# Wait matching on log message
605barrier b1 sync
606
Christopher Faulet1c521212022-11-22 15:39:12 +0100607
608# http scheme, no port for the authority but default port for host value => no normalization
609client c22 -connect ${h1_fe_sock} {
610 txreq \
611 -req "GET" \
612 -url "http://hostname/c22" \
613 -hdr "host: hostname:80"
614
615 rxresp
616 expect resp.status == 200
617} -run
618
Christopher Faulet725d5472023-06-19 19:00:52 +0200619# Wait matching on log message
620barrier b1 sync
621
Christopher Faulet1c521212022-11-22 15:39:12 +0100622# https scheme, no port for the authority but default port for host value => no normalization
623client c23 -connect ${h1_fe_sock} {
624 txreq \
625 -req "GET" \
626 -url "https://hostname/c23" \
627 -hdr "host: hostname:443"
628
629 rxresp
630 expect resp.status == 200
631} -run
632
Christopher Faulet725d5472023-06-19 19:00:52 +0200633# Wait matching on log message
634barrier b1 sync
635
Christopher Faulet1c521212022-11-22 15:39:12 +0100636
637# http scheme, empty port for the authority and no port for host value => should be normalized
638client c24 -connect ${h1_fe_sock} {
639 txreq \
640 -req "GET" \
641 -url "http://hostname:/c24" \
642 -hdr "host: hostname"
643
644 rxresp
645 expect resp.status == 200
646} -run
647
Christopher Faulet725d5472023-06-19 19:00:52 +0200648# Wait matching on log message
649barrier b1 sync
650
Christopher Faulet1c521212022-11-22 15:39:12 +0100651# https scheme, empty port for the authority and no port for host value => should be normalized
652client c25 -connect ${h1_fe_sock} {
653 txreq \
654 -req "GET" \
655 -url "https://hostname:/c25" \
656 -hdr "host: hostname"
657
658 rxresp
659 expect resp.status == 200
660} -run
661
Christopher Faulet725d5472023-06-19 19:00:52 +0200662# Wait matching on log message
663barrier b1 sync
664
Christopher Faulet1c521212022-11-22 15:39:12 +0100665# http scheme, no port for the authority and empty port for host value => no normalization
666client c26 -connect ${h1_fe_sock} {
667 txreq \
668 -req "GET" \
669 -url "http://hostname/c26" \
670 -hdr "host: hostname:"
671
672 rxresp
673 expect resp.status == 200
674} -run
675
Christopher Faulet725d5472023-06-19 19:00:52 +0200676# Wait matching on log message
677barrier b1 sync
678
Christopher Faulet1c521212022-11-22 15:39:12 +0100679# https scheme, no port for the authority and empty port for host value => no normalization
680client c27 -connect ${h1_fe_sock} {
681 txreq \
682 -req "GET" \
683 -url "https://hostname/c27" \
684 -hdr "host: hostname:"
685
686 rxresp
687 expect resp.status == 200
688} -run
689
Christopher Faulet725d5472023-06-19 19:00:52 +0200690# Wait matching on log message
691barrier b1 sync
692
Christopher Faulet1c521212022-11-22 15:39:12 +0100693# http scheme, default port for the authority and empty port for host value => should be normalized
694client c28 -connect ${h1_fe_sock} {
695 txreq \
696 -req "GET" \
697 -url "http://hostname:80/c28" \
698 -hdr "host: hostname:"
699
700 rxresp
701 expect resp.status == 200
702} -run
703
Christopher Faulet725d5472023-06-19 19:00:52 +0200704# Wait matching on log message
705barrier b1 sync
706
Christopher Faulet1c521212022-11-22 15:39:12 +0100707# http scheme, empty port for the authority and default port for host value => should be normalized
708client c29 -connect ${h1_fe_sock} {
709 txreq \
710 -req "GET" \
711 -url "http://hostname:/c29" \
712 -hdr "host: hostname:80"
713
714 rxresp
715 expect resp.status == 200
716} -run
717
Christopher Faulet725d5472023-06-19 19:00:52 +0200718# Wait matching on log message
719barrier b1 sync
720
Christopher Faulet1c521212022-11-22 15:39:12 +0100721# https scheme, default port for the authority and empty port for host value => should be normalized
722client c30 -connect ${h1_fe_sock} {
723 txreq \
724 -req "GET" \
725 -url "https://hostname:443/c30" \
726 -hdr "host: hostname:"
727
728 rxresp
729 expect resp.status == 200
730} -run
731
Christopher Faulet725d5472023-06-19 19:00:52 +0200732# Wait matching on log message
733barrier b1 sync
734
Christopher Faulet1c521212022-11-22 15:39:12 +0100735# https scheme, empty port for the authority and default port for host value => should be normalized
736client c31 -connect ${h1_fe_sock} {
737 txreq \
738 -req "GET" \
739 -url "https://hostname:/c31" \
740 -hdr "host: hostname:443"
741
742 rxresp
743 expect resp.status == 200
744} -run
745
Christopher Faulet725d5472023-06-19 19:00:52 +0200746# Wait matching on log message
747barrier b1 sync
748
Christopher Faulet1c521212022-11-22 15:39:12 +0100749# Strange cases
750client c32 -connect ${h1_fe_sock} {
751 txreq \
752 -req "GET" \
753 -url "http://:" \
754 -hdr "host: :80"
755
756 rxresp
757 expect resp.status == 200
758} -run
759
Christopher Faulet725d5472023-06-19 19:00:52 +0200760# Wait matching on log message
761barrier b1 sync
762
Christopher Faulet1c521212022-11-22 15:39:12 +0100763
764client c33 -connect ${h1_fe_sock} {
765 txreq \
766 -req "GET" \
767 -url "https://:" \
768 -hdr "host: :443"
769
770 rxresp
771 expect resp.status == 200
772} -run
773
Christopher Faulet725d5472023-06-19 19:00:52 +0200774# Wait matching on log message
775barrier b1 sync
776
Christopher Faulet1c521212022-11-22 15:39:12 +0100777# Strange cases
778client c34 -connect ${h1_fe_sock} {
779 txreq \
780 -req "GET" \
781 -url "http://:" \
782 -hdr "host: :"
783
784 rxresp
785 expect resp.status == 200
786} -run
787
Christopher Faulet725d5472023-06-19 19:00:52 +0200788# Wait matching on log message
789barrier b1 sync
790
Christopher Faulet1c521212022-11-22 15:39:12 +0100791
792client c35 -connect ${h1_fe_sock} {
793 txreq \
794 -req "GET" \
795 -url "https://:" \
796 -hdr "host: :"
797
798 rxresp
799 expect resp.status == 200
800} -run
801
Christopher Faulet98b157e2024-05-24 15:59:35 +0200802# Wait matching on log message
803barrier b1 sync
804
805client c36 -connect ${h1_fe_sock} {
806 txreq \
807 -req "GET" \
808 -url "http://hostname" \
809 -hdr "host: hostname"
810
811 rxresp
812 expect resp.status == 200
813} -run
814
815# Wait matching on log message
816barrier b1 sync
817
818client c37 -connect ${h1_fe_sock} {
819 txreq \
820 -req "GET" \
821 -url "http://hostname:80" \
822 -hdr "host: hostname"
823
824 rxresp
825 expect resp.status == 200
826} -run
827
828# Wait matching on log message
829barrier b1 sync
830
831client c38 -connect ${h1_fe_sock} {
832 txreq \
833 -req "GET" \
834 -url "http://hostname:" \
835 -hdr "host: hostname"
836
837 rxresp
838 expect resp.status == 200
839} -run
840
841# Wait matching on log message
842barrier b1 sync
843
844client c39 -connect ${h1_fe_sock} {
845 txreq \
846 -req "GET" \
847 -url "https://hostname" \
848 -hdr "host: hostname"
849
850 rxresp
851 expect resp.status == 200
852} -run
853
854# Wait matching on log message
855barrier b1 sync
856
857client c40 -connect ${h1_fe_sock} {
858 txreq \
859 -req "GET" \
860 -url "https://hostname:443" \
861 -hdr "host: hostname"
862
863 rxresp
864 expect resp.status == 200
865} -run
866
867# Wait matching on log message
868barrier b1 sync
869
870client c41 -connect ${h1_fe_sock} {
871 txreq \
872 -req "GET" \
873 -url "https://hostname:" \
874 -hdr "host: hostname"
875
876 rxresp
877 expect resp.status == 200
878} -run
879
880# Wait matching on log message
881barrier b1 sync
882
883client c42 -connect ${h1_fe_sock} {
884 txreq \
885 -req "GET" \
886 -url "http://hostname:81" \
887 -hdr "host: hostname:81"
888
889 rxresp
890 expect resp.status == 200
891} -run
892
893# Wait matching on log message
894barrier b1 sync
895
896client c43 -connect ${h1_fe_sock} {
897 txreq \
898 -req "GET" \
899 -url "https://hostname:444" \
900 -hdr "host: hostname:444"
901
902 rxresp
903 expect resp.status == 200
904} -run
905
Christopher Faulet3f5fbe92022-07-05 14:50:17 +0200906syslog S1 -wait