Christopher Faulet | 4f33760 | 2020-11-17 10:47:35 +0100 | [diff] [blame] | 1 | varnishtest "Filtering test with several filters and random forwarding (via trace filter)" |
| 2 | |
| 3 | #REQUIRE_VERSION=2.4 |
| 4 | #REQUIRE_OPTION=ZLIB|SLZ |
| 5 | #REGTEST_TYPE=slow |
| 6 | |
| 7 | feature ignore_unknown_macro |
| 8 | |
| 9 | barrier b1 cond 2 -cyclic |
| 10 | |
| 11 | server s1 { |
| 12 | rxreq |
| 13 | expect req.url == "/" |
| 14 | expect req.bodylen == 1048576 |
| 15 | expect req.http.accept-encoding == "<undef>" |
| 16 | txresp \ |
| 17 | -hdr "Content-Type: text/plain" \ |
| 18 | -bodylen 1048576 |
| 19 | |
| 20 | rxreq |
| 21 | expect req.url == "/" |
| 22 | txresp \ |
| 23 | -hdr "Content-Length: 0" |
| 24 | recv 36000 |
| 25 | send_n 1000 "0123456789abcdefghijklmnopqrstuvwxyz" |
| 26 | barrier b1 sync |
Christopher Faulet | 6071c2d | 2021-01-25 12:02:00 +0100 | [diff] [blame] | 27 | |
| 28 | accept |
| 29 | rxreq |
| 30 | expect req.url == "/" |
| 31 | txresp -nolen \ |
| 32 | -hdr "Content-Type: text/plain" \ |
| 33 | -bodylen 20480 |
| 34 | close |
| 35 | |
| 36 | accept |
| 37 | rxreq |
| 38 | expect req.url == "/" |
| 39 | txresp -nolen |
Christopher Faulet | 4f33760 | 2020-11-17 10:47:35 +0100 | [diff] [blame] | 40 | } -start |
| 41 | |
| 42 | haproxy h1 -conf { |
| 43 | defaults |
| 44 | mode http |
| 45 | ${no-htx} option http-use-htx |
| 46 | timeout connect 1s |
| 47 | timeout client 1s |
| 48 | timeout server 1s |
| 49 | |
| 50 | frontend fe1 |
| 51 | bind "fd@${fe1}" |
| 52 | |
| 53 | compression offload |
| 54 | compression algo gzip |
| 55 | |
| 56 | filter trace name "BEFORE" random-forwarding quiet |
| 57 | filter compression |
| 58 | filter trace name "AFTER" random-forwarding quiet |
| 59 | default_backend be1 |
| 60 | |
| 61 | backend be1 |
| 62 | server www ${s1_addr}:${s1_port} |
| 63 | |
| 64 | } -start |
| 65 | |
| 66 | client c1 -connect ${h1_fe1_sock} { |
| 67 | txreq -url "/" \ |
| 68 | -hdr "Accept-Encoding: gzip" \ |
| 69 | -hdr "Content-Type: text/plain" \ |
| 70 | -bodylen 1048576 |
| 71 | rxresp |
| 72 | expect resp.status == 200 |
| 73 | expect resp.http.content-encoding == "gzip" |
| 74 | expect resp.http.transfer-encoding == "chunked" |
| 75 | gunzip |
| 76 | expect resp.bodylen == 1048576 |
| 77 | |
| 78 | txreq -method "CONNECT" -url "/" -nolen |
| 79 | rxresp |
| 80 | expect resp.status == 200 |
| 81 | send_n 1000 "0123456789abcdefghijklmnopqrstuvwxyz" |
| 82 | recv 36000 |
| 83 | barrier b1 sync |
| 84 | } -run |
Christopher Faulet | 6071c2d | 2021-01-25 12:02:00 +0100 | [diff] [blame] | 85 | |
| 86 | client c2 -connect ${h1_fe1_sock} { |
| 87 | txreq -url "/" \ |
| 88 | -hdr "Accept-Encoding: gzip" \ |
| 89 | -hdr "Content-Type: text/plain" |
| 90 | rxresp |
| 91 | expect resp.status == 200 |
| 92 | expect resp.http.content-encoding == "<undef>" |
| 93 | expect resp.http.transfer-encoding == "<undef>" |
| 94 | expect resp.http.content-length == "<undef>" |
| 95 | expect resp.bodylen == 20480 |
| 96 | } -run |
| 97 | |
| 98 | client c3 -connect ${h1_fe1_sock} { |
| 99 | txreq -url "/" \ |
| 100 | -hdr "Accept-Encoding: gzip" \ |
| 101 | -hdr "Content-Type: text/plain" |
| 102 | rxresp |
| 103 | expect resp.status == 200 |
| 104 | expect resp.http.content-encoding == "<undef>" |
| 105 | expect resp.http.transfer-encoding == "<undef>" |
| 106 | expect resp.http.content-length == "<undef>" |
| 107 | expect resp.bodylen == 0 |
| 108 | } -run |