REGTEST: Add an HTX reg-test to check an edge case

This test checks that an HTTP message is properly processed when we failed to
add the HTX EOM block in an HTX message during the parsing because the buffer is
full. Some space must be released in the buffer to make it possible. This
requires an extra pass in the H1 multiplexer. Here, we must be sure the mux is
called while there is no more incoming data.

It is a "devel" test because conditions to run the test successfully is highly
dependent on the implementation. So if it fail, it is not necessarily a bug. It
may be due of an internal change. It relies on internal HTX sample fetches.
This commit is contained in:
Christopher Faulet 2019-12-11 16:26:11 +01:00
parent 29f7284333
commit 1eee6ca89e
2 changed files with 63 additions and 2 deletions

View File

@ -0,0 +1,61 @@
varnishtest "cannot add the HTX EOM block because the buffer is full"
feature ignore_unknown_macro
#REQUIRE_VERSION=2.2
#REGTEST_TYPE=devel
# This test checks that an HTTP message is properly processed when we failed to
# add the HTX EOM block in an HTX message during the parsing because the buffer
# is full. Some space must be released in the buffer to make it possible. This
# requires an extra pass in the H1 multiplexer. Here, we must be sure the mux is
# called while there is no more incoming data.
server s1 {
rxreq
expect req.bodylen == 15200
txresp -bodylen 15220
} -start
syslog S -level info {
recv
expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1/srv1 [0-9]*/[0-9]*/[0-9]*/[0-9]*/[0-9]* 200 .* - - ---- .* .* \"GET / HTTP/1\\.1\""
} -start
haproxy h1 -conf {
global
tune.bufsize 16384
tune.maxrewrite 1024
defaults
mode http
timeout client 100ms
timeout server 1s
timeout connect 1s
backend be1
tcp-response inspect-delay 100ms
tcp-response content accept if { res.len gt 15272 }
tcp-response content reject
http-response deny if { htx.has_eom -m bool } or { htx.free_data gt 1024 }
server srv1 ${s1_addr}:${s1_port}
frontend fe1
option httplog
option http-buffer-request
log ${S_addr}:${S_port} local0 debug err
bind "fd@${fe1}"
http-request deny if ! { req.body_len eq 15200 } or { htx.has_eom -m bool } or { htx.free_data gt 1024 }
use_backend be1
} -start
haproxy h1 -cli {
send "trace h1 sink stderr; trace h1 level developer; trace h1 verbosity complete; trace h1 start now"
}
client c1 -connect ${h1_fe1_sock} {
txreq -bodylen 15200
rxresp
expect resp.status == 200
expect resp.bodylen == 15220
} -run

View File

@ -30,8 +30,8 @@ _help()
--type <reg tests types> filter the types of the tests to be run, depending on
the commented REGTESTS_TYPE variable value in each VTC file.
The value of REGTESTS_TYPE supported are: default, slow, bug, broken and
experimental. When not specified, it is set to 'default' as default value.
The value of REGTESTS_TYPE supported are: default, slow, bug, broken, devel
and experimental. When not specified, it is set to 'default' as default value.
run-regtest.sh --type slow,default