Christopher Faulet | a8ecbc4 | 2021-11-26 18:18:40 +0100 | [diff] [blame] | 1 | # This reg-test checks splicing support for the H1 multiplexer |
| 2 | |
| 3 | varnishtest "A test to validate h1 splicing support" |
| 4 | |
| 5 | feature cmd "$HAPROXY_PROGRAM -cc 'version_atleast(2.6-dev0)'" |
| 6 | feature cmd "$HAPROXY_PROGRAM -cc 'feature(LINUX_SPLICE)'" |
| 7 | feature ignore_unknown_macro |
| 8 | |
| 9 | #REGTEST_TYPE=slow |
| 10 | |
| 11 | server s1 { |
| 12 | rxreq |
| 13 | expect req.http.content-length == "1048576" |
| 14 | expect req.bodylen == 1048576 |
| 15 | txresp -status 200 -bodylen 1048576 |
| 16 | } -start |
| 17 | |
| 18 | server s2 { |
| 19 | rxreq |
| 20 | txresp -status 200 -nolen -bodylen 1048576 |
| 21 | } -start |
| 22 | |
| 23 | haproxy h1 -conf { |
| 24 | global |
| 25 | log stderr len 4096 local0 debug |
| 26 | |
| 27 | defaults |
| 28 | mode http |
| 29 | timeout client "${HAPROXY_TEST_TIMEOUT-5s}" |
| 30 | timeout server "${HAPROXY_TEST_TIMEOUT-5s}" |
| 31 | timeout connect "${HAPROXY_TEST_TIMEOUT-5s}" |
| 32 | option splice-request |
| 33 | option splice-response |
| 34 | log global |
| 35 | option httplog |
| 36 | |
| 37 | listen li1 |
| 38 | bind "fd@${li1}" |
| 39 | id 10 |
| 40 | server srv1 ${s1_addr}:${s1_port} |
| 41 | |
| 42 | listen li2 |
| 43 | bind "fd@${li2}" |
| 44 | id 20 |
| 45 | server srv2 ${s2_addr}:${s2_port} |
| 46 | } -start |
| 47 | |
| 48 | |
| 49 | client c1 -connect ${h1_li1_sock} { |
| 50 | txreq -method POST -url "/" -bodylen 1048576 |
| 51 | rxresp |
| 52 | expect resp.status == 200 |
| 53 | expect resp.http.content-length == "1048576" |
| 54 | expect resp.bodylen == 1048576 |
| 55 | } -run |
| 56 | |
| 57 | client c2 -connect ${h1_li2_sock} { |
| 58 | txreq -url "/" |
| 59 | rxresp |
| 60 | expect resp.status == 200 |
| 61 | expect resp.http.content-length == <undef> |
| 62 | expect resp.bodylen == 1048576 |
| 63 | } -run |
| 64 | |
| 65 | haproxy h1 -cli { |
| 66 | send "show stat typed" |
| 67 | expect ~ "F.10.0.[[:digit:]]+.h1_spliced_bytes_in.1:MCP:u64:[1-9][[:digit:]]+\nF.10.0.[[:digit:]]+.h1_spliced_bytes_out.1:MCP:u64:[1-9][[:digit:]]+" |
| 68 | send "show stat typed" |
| 69 | expect ~ "B.10.0.[[:digit:]]+.h1_spliced_bytes_in.1:MCP:u64:[1-9][[:digit:]]+\nB.10.0.[[:digit:]]+.h1_spliced_bytes_out.1:MCP:u64:[1-9][[:digit:]]+" |
| 70 | |
| 71 | send "show stat typed" |
| 72 | expect ~ "F.20.0.[[:digit:]]+.h1_spliced_bytes_in.1:MCP:u64:0\nF.20.0.[[:digit:]]+.h1_spliced_bytes_out.1:MCP:u64:[1-9][[:digit:]]+" |
| 73 | send "show stat typed" |
| 74 | expect ~ "B.20.0.[[:digit:]]+.h1_spliced_bytes_in.1:MCP:u64:[1-9][[:digit:]]+\nB.20.0.[[:digit:]]+.h1_spliced_bytes_out.1:MCP:u64:0" |
| 75 | } |