1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
varnishtest "Compression ignores small payloads"
#REQUIRE_OPTION=ZLIB|SLZ
feature ignore_unknown_macro
server s1 {
rxreq
expect req.url == "/response-lower"
expect req.http.accept-encoding == "gzip"
txresp \
-hdr "Content-Type: text/plain" \
-hdr "ETag: \"123\"" \
-bodylen 50
rxreq
expect req.url == "/response-equal"
expect req.http.accept-encoding == "gzip"
txresp \
-hdr "Content-Type: text/plain" \
-hdr "ETag: \"123\"" \
-bodylen 1024
rxreq
expect req.url == "/response-greater"
expect req.http.accept-encoding == "gzip"
txresp \
-hdr "Content-Type: text/plain" \
-hdr "ETag: \"123\"" \
-bodylen 2000
rxreq
expect req.url == "/request-lower"
expect req.http.content-encoding == "<undef>"
expect req.method == "POST"
expect resp.bodylen == 50
txresp
rxreq
expect req.url == "/request-equal"
expect req.http.content-encoding == "gzip"
expect req.method == "POST"
gunzip
expect resp.bodylen == 800
txresp
rxreq
expect req.url == "/request-greater"
expect req.http.content-encoding == "gzip"
expect req.method == "POST"
gunzip
expect resp.bodylen == 2000
txresp
} -start
haproxy h1 -conf {
global
# WT: limit false-positives causing "HTTP header incomplete" due to
# idle server connections being randomly used and randomly expiring
# under us.
tune.idle-pool.shared off
defaults
mode http
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
frontend fe-gzip
bind "fd@${fe_gzip}"
default_backend be-gzip
backend be-gzip
compression direction both
compression algo-res gzip
compression type-res text/plain
compression minsize-res 1k
compression algo-req gzip
compression type-req text/plain
compression minsize-req 800
server www ${s1_addr}:${s1_port}
} -start
client c1 -connect ${h1_fe_gzip_sock} {
txreq -url "/response-lower" \
-hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.content-encoding == "<undef>"
expect resp.http.etag == "\"123\""
expect resp.bodylen == 50
txreq -url "/response-equal" \
-hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.content-encoding == "gzip"
expect resp.http.etag == "W/\"123\""
gunzip
expect resp.bodylen == 1024
txreq -url "/response-greater" \
-hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.content-encoding == "gzip"
expect resp.http.etag == "W/\"123\""
gunzip
expect resp.bodylen == 2000
txreq -method POST \
-url "/request-lower" \
-hdr "Content-Type: text/plain" \
-bodylen 50
rxresp
expect resp.status == 200
txreq -method POST \
-url "/request-equal" \
-hdr "Content-Type: text/plain" \
-bodylen 800
rxresp
expect resp.status == 200
txreq -method POST \
-url "/request-greater" \
-hdr "Content-Type: text/plain" \
-bodylen 2000
rxresp
expect resp.status == 200
} -run
|