blob: 2edba7db2d2205c82692a1eab20b2b077b2340f8 [file] [log] [blame]
Christopher Faulet1eee6ca2019-12-11 16:26:11 +01001varnishtest "cannot add the HTX EOM block because the buffer is full"
2feature ignore_unknown_macro
3
4#REQUIRE_VERSION=2.2
Christopher Fauletd8b44f02020-12-15 14:53:03 +01005#REQUIRE_VERSION_BELOW=2.4
Christopher Faulet1eee6ca2019-12-11 16:26:11 +01006#REGTEST_TYPE=devel
7
8# This test checks that an HTTP message is properly processed when we failed to
9# add the HTX EOM block in an HTX message during the parsing because the buffer
10# is full. Some space must be released in the buffer to make it possible. This
11# requires an extra pass in the H1 multiplexer. Here, we must be sure the mux is
12# called while there is no more incoming data.
13
14server s1 {
15 rxreq
16 expect req.bodylen == 15200
17 txresp -bodylen 15220
18} -start
19
20syslog S -level info {
21 recv
22 expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 be1/srv1 [0-9]*/[0-9]*/[0-9]*/[0-9]*/[0-9]* 200 .* - - ---- .* .* \"GET / HTTP/1\\.1\""
23} -start
24
25haproxy h1 -conf {
26 global
27 tune.bufsize 16384
28 tune.maxrewrite 1024
29
30 defaults
31 mode http
Willy Tarreauf6739232021-11-18 17:46:22 +010032 timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
33 timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
34 timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
Christopher Faulet1eee6ca2019-12-11 16:26:11 +010035
36 backend be1
37 tcp-response inspect-delay 100ms
38 tcp-response content accept if { res.len gt 15272 }
39 tcp-response content reject
40
Christopher Faulet01f44452020-01-08 14:23:40 +010041 http-response deny if { internal.htx.has_eom -m bool } or { internal.htx.free_data gt 1024 }
Christopher Faulet1eee6ca2019-12-11 16:26:11 +010042 server srv1 ${s1_addr}:${s1_port}
43
44 frontend fe1
45 option httplog
46 option http-buffer-request
47 log ${S_addr}:${S_port} local0 debug err
48 bind "fd@${fe1}"
Christopher Faulet01f44452020-01-08 14:23:40 +010049 http-request deny if ! { req.body_len eq 15200 } or { internal.htx.has_eom -m bool } or { internal.htx.free_data gt 1024 }
Christopher Faulet1eee6ca2019-12-11 16:26:11 +010050 use_backend be1
51} -start
52
53haproxy h1 -cli {
54 send "trace h1 sink stderr; trace h1 level developer; trace h1 verbosity complete; trace h1 start now"
55}
56
57client c1 -connect ${h1_fe1_sock} {
58 txreq -bodylen 15200
59 rxresp
60 expect resp.status == 200
61 expect resp.bodylen == 15220
62} -run