blob: ba3336a08c958b975f1993c768c61787e46bb2fe [file] [log] [blame]
Remi Tricot-Le Breton5bbdc812020-10-22 10:40:06 +02001varnishtest "If-None-Match support"
2
3#REQUIRE_VERSION=2.3
4
5feature ignore_unknown_macro
6
7server s1 {
8 rxreq
9 txresp -nolen -hdr "Transfer-Encoding: chunked" \
10 -hdr "ETag: \"etag\""
11 chunkedlen 1
12 chunkedlen 1
13 chunkedlen 2
14 chunkedlen 3
15 chunkedlen 5
16 chunkedlen 8
17 chunkedlen 13
18 chunkedlen 21
19 chunkedlen 34
20 chunkedlen 55
21 chunkedlen 89
22 chunkedlen 144
23 chunkedlen 233
24 chunkedlen 0
25} -start
26
27haproxy h1 -conf {
Willy Tarreaue1465c12021-05-09 14:41:41 +020028 global
29 # WT: limit false-positives causing "HTTP header incomplete" due to
30 # idle server connections being randomly used and randomly expiring
31 # under us.
32 tune.idle-pool.shared off
33
Remi Tricot-Le Breton5bbdc812020-10-22 10:40:06 +020034 defaults
35 mode http
36 ${no-htx} option http-use-htx
37 timeout connect 1s
38 timeout client 1s
39 timeout server 1s
40
41 frontend fe
42 bind "fd@${fe}"
43 default_backend test
44
45 backend test
46 http-request cache-use my_cache
47 server www ${s1_addr}:${s1_port}
48 http-response cache-store my_cache
49
50 cache my_cache
51 total-max-size 3
52 max-age 20
53 max-object-size 3072
54} -start
55
56
57client c1 -connect ${h1_fe_sock} {
58 txreq
59 rxresp
60 expect resp.status == 200
61 expect resp.bodylen == 609
62 txreq
63 rxresp
64 expect resp.status == 200
65 expect resp.bodylen == 609
66 txreq \
67 -hdr "if-none-match: *"
68 rxresp
69 expect resp.status == 304
70 txreq \
71 -hdr "if-none-match: \"etag\""
72 rxresp
73 expect resp.status == 304
74 txreq \
75 -hdr "if-none-match: W/\"etag\""
76 rxresp
77 expect resp.status == 304
78} -run
79
80client c2 -connect ${h1_fe_sock} {
81 txreq \
82 -hdr "if-none-match: \"wrong_etag\""
83 rxresp
84 expect resp.status == 200
85 expect resp.bodylen == 609
86 txreq \
87 -hdr "if-none-match: W/\"wrong_etag\", W/\"etag\""
88 rxresp
89 expect resp.status == 304
90} -run