mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 07:07:04 +02:00
REGTESTS: cache: Use rxresphdrs to only get headers for 304 responses
304 responses contains "Content-length" or "Transfer-encoding" headers. rxresp action expects to get a payload in this case, even if 304 reponses must not have any payload. A workaround was added to remove these headers from the 304 responses. However, a better solution is to only get the response headers from clients using rxresphdrs action. If a payload is erroneously added in these reponses, the scripts will fail the same way. So it is safe.
This commit is contained in:
parent
be5cc766b0
commit
34cffede3a
22
reg-tests/cache/if-modified-since.vtc
vendored
22
reg-tests/cache/if-modified-since.vtc
vendored
@ -61,10 +61,6 @@ haproxy h1 -conf {
|
|||||||
server www ${s1_addr}:${s1_port}
|
server www ${s1_addr}:${s1_port}
|
||||||
http-response cache-store my_cache
|
http-response cache-store my_cache
|
||||||
|
|
||||||
# Remove Transfer-Encoding header because of a vtest issue with
|
|
||||||
# 304-Not-Modified responses
|
|
||||||
http-after-response del-header transfer-encoding if { status eq 304 }
|
|
||||||
|
|
||||||
cache my_cache
|
cache my_cache
|
||||||
total-max-size 3
|
total-max-size 3
|
||||||
max-age 20
|
max-age 20
|
||||||
@ -114,41 +110,35 @@ client c1 -connect ${h1_fe_sock} {
|
|||||||
# "Last-Modified" version
|
# "Last-Modified" version
|
||||||
txreq -url "/last_modified" \
|
txreq -url "/last_modified" \
|
||||||
-hdr "If-Modified-Since: Thu, 15 Oct 2020 22:23:24 GMT"
|
-hdr "If-Modified-Since: Thu, 15 Oct 2020 22:23:24 GMT"
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
expect resp.bodylen == 0
|
|
||||||
# "Date" version
|
# "Date" version
|
||||||
txreq -url "/date" \
|
txreq -url "/date" \
|
||||||
-hdr "If-Modified-Since: Thu, 22 Oct 2020 16:51:12 GMT"
|
-hdr "If-Modified-Since: Thu, 22 Oct 2020 16:51:12 GMT"
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
expect resp.bodylen == 0
|
|
||||||
# "Last-Modified" and "Date" version
|
# "Last-Modified" and "Date" version
|
||||||
txreq -url "/last_modified_and_date" \
|
txreq -url "/last_modified_and_date" \
|
||||||
-hdr "If-Modified-Since: Thu, 15 Oct 2020 16:51:12 GMT"
|
-hdr "If-Modified-Since: Thu, 15 Oct 2020 16:51:12 GMT"
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
expect resp.bodylen == 0
|
|
||||||
|
|
||||||
|
|
||||||
# Later date
|
# Later date
|
||||||
# "Last-Modified" version
|
# "Last-Modified" version
|
||||||
txreq -url "/last_modified" \
|
txreq -url "/last_modified" \
|
||||||
-hdr "If-Modified-Since: Thu, 22 Oct 2020 23:00:00 GMT"
|
-hdr "If-Modified-Since: Thu, 22 Oct 2020 23:00:00 GMT"
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
expect resp.bodylen == 0
|
|
||||||
# "Date" version
|
# "Date" version
|
||||||
txreq -url "/date" \
|
txreq -url "/date" \
|
||||||
-hdr "If-Modified-Since: Thu, 22 Oct 2020 23:00:00 GMT"
|
-hdr "If-Modified-Since: Thu, 22 Oct 2020 23:00:00 GMT"
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
expect resp.bodylen == 0
|
|
||||||
# "Last-Modified" and "Date" version
|
# "Last-Modified" and "Date" version
|
||||||
txreq -url "/last_modified_and_date" \
|
txreq -url "/last_modified_and_date" \
|
||||||
-hdr "If-Modified-Since: Thu, 22 Oct 2020 23:00:00 GMT"
|
-hdr "If-Modified-Since: Thu, 22 Oct 2020 23:00:00 GMT"
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
expect resp.bodylen == 0
|
|
||||||
|
|
||||||
} -run
|
} -run
|
||||||
|
12
reg-tests/cache/if-none-match.vtc
vendored
12
reg-tests/cache/if-none-match.vtc
vendored
@ -46,10 +46,6 @@ haproxy h1 -conf {
|
|||||||
server www ${s1_addr}:${s1_port}
|
server www ${s1_addr}:${s1_port}
|
||||||
http-response cache-store my_cache
|
http-response cache-store my_cache
|
||||||
|
|
||||||
# Remove Transfer-Encoding header because of a vtest issue with
|
|
||||||
# 304-Not-Modified responses
|
|
||||||
http-after-response del-header transfer-encoding if { status eq 304 }
|
|
||||||
|
|
||||||
cache my_cache
|
cache my_cache
|
||||||
total-max-size 3
|
total-max-size 3
|
||||||
max-age 20
|
max-age 20
|
||||||
@ -68,15 +64,15 @@ client c1 -connect ${h1_fe_sock} {
|
|||||||
expect resp.bodylen == 609
|
expect resp.bodylen == 609
|
||||||
txreq \
|
txreq \
|
||||||
-hdr "if-none-match: *"
|
-hdr "if-none-match: *"
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
txreq \
|
txreq \
|
||||||
-hdr "if-none-match: \"etag\""
|
-hdr "if-none-match: \"etag\""
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
txreq \
|
txreq \
|
||||||
-hdr "if-none-match: W/\"etag\""
|
-hdr "if-none-match: W/\"etag\""
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
} -run
|
} -run
|
||||||
|
|
||||||
@ -88,6 +84,6 @@ client c2 -connect ${h1_fe_sock} {
|
|||||||
expect resp.bodylen == 609
|
expect resp.bodylen == 609
|
||||||
txreq \
|
txreq \
|
||||||
-hdr "if-none-match: W/\"wrong_etag\", W/\"etag\""
|
-hdr "if-none-match: W/\"wrong_etag\", W/\"etag\""
|
||||||
rxresp
|
rxresphdrs
|
||||||
expect resp.status == 304
|
expect resp.status == 304
|
||||||
} -run
|
} -run
|
||||||
|
Loading…
Reference in New Issue
Block a user