blob: b5ad033bb9590434de97e45f2abbad238c8049cb [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
Willy Tarreauf6739232021-11-18 17:46:22 +010036 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
37 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
38 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
Remi Tricot-Le Breton5bbdc812020-10-22 10:40:06 +020039
40 frontend fe
41 bind "fd@${fe}"
42 default_backend test
43
44 backend test
45 http-request cache-use my_cache
46 server www ${s1_addr}:${s1_port}
47 http-response cache-store my_cache
48
49 cache my_cache
50 total-max-size 3
51 max-age 20
52 max-object-size 3072
53} -start
54
55
56client c1 -connect ${h1_fe_sock} {
57 txreq
58 rxresp
59 expect resp.status == 200
60 expect resp.bodylen == 609
61 txreq
62 rxresp
63 expect resp.status == 200
64 expect resp.bodylen == 609
65 txreq \
66 -hdr "if-none-match: *"
67 rxresp
68 expect resp.status == 304
69 txreq \
70 -hdr "if-none-match: \"etag\""
71 rxresp
72 expect resp.status == 304
73 txreq \
74 -hdr "if-none-match: W/\"etag\""
75 rxresp
76 expect resp.status == 304
77} -run
78
79client c2 -connect ${h1_fe_sock} {
80 txreq \
81 -hdr "if-none-match: \"wrong_etag\""
82 rxresp
83 expect resp.status == 200
84 expect resp.bodylen == 609
85 txreq \
86 -hdr "if-none-match: W/\"wrong_etag\", W/\"etag\""
87 rxresp
88 expect resp.status == 304
89} -run