Christopher Faulet | 1eee6ca | 2019-12-11 16:26:11 +0100 | [diff] [blame] | 1 | varnishtest "cannot add the HTX EOM block because the buffer is full" |
| 2 | feature ignore_unknown_macro |
| 3 | |
| 4 | #REQUIRE_VERSION=2.2 |
Christopher Faulet | d8b44f0 | 2020-12-15 14:53:03 +0100 | [diff] [blame] | 5 | #REQUIRE_VERSION_BELOW=2.4 |
Christopher Faulet | 1eee6ca | 2019-12-11 16:26:11 +0100 | [diff] [blame] | 6 | #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 | |
| 14 | server s1 { |
| 15 | rxreq |
| 16 | expect req.bodylen == 15200 |
| 17 | txresp -bodylen 15220 |
| 18 | } -start |
| 19 | |
| 20 | syslog 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 | |
| 25 | haproxy h1 -conf { |
| 26 | global |
| 27 | tune.bufsize 16384 |
| 28 | tune.maxrewrite 1024 |
| 29 | |
| 30 | defaults |
| 31 | mode http |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 32 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 33 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
| 34 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
Christopher Faulet | 1eee6ca | 2019-12-11 16:26:11 +0100 | [diff] [blame] | 35 | |
| 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 Faulet | 01f4445 | 2020-01-08 14:23:40 +0100 | [diff] [blame] | 41 | http-response deny if { internal.htx.has_eom -m bool } or { internal.htx.free_data gt 1024 } |
Christopher Faulet | 1eee6ca | 2019-12-11 16:26:11 +0100 | [diff] [blame] | 42 | 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 Faulet | 01f4445 | 2020-01-08 14:23:40 +0100 | [diff] [blame] | 49 | http-request deny if ! { req.body_len eq 15200 } or { internal.htx.has_eom -m bool } or { internal.htx.free_data gt 1024 } |
Christopher Faulet | 1eee6ca | 2019-12-11 16:26:11 +0100 | [diff] [blame] | 50 | use_backend be1 |
| 51 | } -start |
| 52 | |
| 53 | haproxy h1 -cli { |
| 54 | send "trace h1 sink stderr; trace h1 level developer; trace h1 verbosity complete; trace h1 start now" |
| 55 | } |
| 56 | |
| 57 | client c1 -connect ${h1_fe1_sock} { |
| 58 | txreq -bodylen 15200 |
| 59 | rxresp |
| 60 | expect resp.status == 200 |
| 61 | expect resp.bodylen == 15220 |
| 62 | } -run |