blob: a41972723def0fea5aa79c17d7260ac43331be73 [file] [log] [blame]
Amaury Denoyellea47dfab2021-03-02 14:39:20 +01001varnishtest "Test the proper interaction between http-reuse and dispatch mode"
2
3# With dispatch, the connection are considered as private and should only be
4# reused for requests of the same session
5# This is similar to the http-reuse never mode
6
7#REQUIRE_VERSION=2.4
8
9feature ignore_unknown_macro
10
11haproxy h1 -conf {
12 defaults
13 mode http
14
15 listen sender
16 bind "fd@${feS}"
17 http-request set-header client-id %[req.hdr(client-id)] if { req.hdr(client-id) -m found }
18 dispatch ${h1_feR_addr}:${h1_feR_port}
19
20 listen receiver
21 bind "fd@${feR}"
22 http-request set-var(sess.client_id) req.hdr(client-id)
23 http-request return status 200
24 http-after-response set-header http_first_request %[http_first_req]
25 http-after-response set-header client-id %[var(sess.client_id)]
26} -start
27
28client c1 -connect ${h1_feS_sock} {
29 txreq \
30 -hdr "client-id: c1"
31 rxresp
32 expect resp.http.http_first_request == "1"
33
34 txreq
35 rxresp
36 expect resp.http.http_first_request == "0"
37 expect resp.http.client-id == "c1"
38
39 txreq
40 rxresp
41 expect resp.http.http_first_request == "0"
42 expect resp.http.client-id == "c1"
43} -run
44
45client c2 -connect ${h1_feS_sock} {
46 txreq \
47 -hdr "client-id: c2"
48 rxresp
49 expect resp.http.http_first_request == "1"
50 expect resp.http.client-id == "c2"
51
52 txreq
53 rxresp
54 expect resp.http.http_first_request == "0"
55 expect resp.http.client-id == "c2"
56
57 txreq
58 rxresp
59 expect resp.http.http_first_request == "0"
60 expect resp.http.client-id == "c2"
61} -run
62
63client c3 -connect ${h1_feS_sock} {
64 txreq \
65 -hdr "client-id: c3"
66 rxresp
67 expect resp.http.http_first_request == "1"
68 expect resp.http.client-id == "c3"
69
70 txreq
71 rxresp
72 expect resp.http.http_first_request == "0"
73 expect resp.http.client-id == "c3"
74
75 txreq
76 rxresp
77 expect resp.http.http_first_request == "0"
78 expect resp.http.client-id == "c3"
79} -run