Commit e4d0b813 by Geoff Simmons

Test error handling.

parent a966ae12
# looks like -*- vcl -*-
varnishtest "test error handling"
# XXX I don't know how to provoke a error for compression, only
# decompresion.
server s1 {
rxreq
txresp -nolen -hdr "Content-Encoding: br" -hdr "Content-Length: 4"
sendhex "de ad be ef"
expect_close
} -start
varnish v1 -arg "-p vsl_mask=+VfpAcct" -vcl+backend {
import ${vmod_brotli};
sub vcl_backend_response {
set beresp.filters = "unbr";
}
} -start
# Streaming is enabled by default, so when the error is detected, both
# resp.status == 200 and Transfer-Encoding:chunked have been sent,
# with an empty client response body. So the connection closes just
# after sending the client response headers. (cf. Varnish issue #2903)
client c1 {
txreq
rxresphdrs
expect_close
} -run
server s1 -wait
server s1 -start
varnish v1 -vcl+backend {
import ${vmod_brotli};
sub vcl_backend_response {
set beresp.do_stream = false;
set beresp.filters = "unbr";
set beresp.uncacheable = true;
}
}
# With streaming disabled, the client gets a 503 response.
client c1 {
txreq
rxresp
expect resp.status == 503
} -run
server s1 -wait
# Correct brotli encoding followed by extraneous data.
server s1 {
rxreq
txresp -hdr "Content-Encoding: br" -body { Xyzzyjunk}
expect_close
} -start
client c1 -run
logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect 0 * Begin bereq
expect * = FetchError {^Invalid brotli data: \S+}
expect * = VfpAcct {^unbr \d+ 0$}
expect * = End
expect 0 * Begin bereq
expect * = FetchError {^Invalid brotli data: \S+}
expect * = VfpAcct {^unbr \d+ 0$}
expect * = End
expect 0 * Begin bereq
expect * = FetchError "Junk after brotli data"
expect * = VfpAcct {^unbr \d+ 0$}
expect * = End
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment