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