Commit 495d5596 authored by Geoff Simmons's avatar Geoff Simmons

Add encoder param large_win.

parent 7c6907a3
......@@ -3,7 +3,7 @@
varnishtest "test various custom parameter settings"
server s1 {
loop 4 {
loop 5 {
rxreq
txresp -body {Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.}
}
......@@ -98,6 +98,24 @@ varnish v1 -vcl+backend {
client c1 -run
# Encoder with large_win only works if the decoder is also set to
# large_win=true.
varnish v1 -vcl+backend {
import ${vmod_brotli};
sub vcl_init {
new br_large = brotli.encoder("br_largewin", large_win=true);
new unbr_large = brotli.decoder("unbr_largewin", large_win=true);
}
sub vcl_backend_response {
set beresp.filters = "br_largewin unbr_largewin";
set beresp.uncacheable = true;
}
}
client c1 -run
logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect 0 * Begin bereq
expect * = VfpAcct {^unbr \d+ 269$}
......@@ -118,4 +136,9 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect * = VfpAcct {^unbr_largewin \d+ 269$}
expect * = VfpAcct {^br \d+ \d+$}
expect * = End
expect 0 * Begin bereq
expect * = VfpAcct {^unbr_largewin \d+ 269$}
expect * = VfpAcct {^br_largewin \d+ \d+$}
expect * = End
} -run
......@@ -149,6 +149,9 @@ setEncoderParams(struct vbr *vbr, const struct vbr_settings *settings)
CHECK_OBJ_NOTNULL(settings, VBR_SETTINGS_MAGIC);
assert(BrotliEncoderSetParameter(vbr->state.enc, BROTLI_PARAM_QUALITY,
settings->quality) == BROTLI_TRUE);
assert(BrotliEncoderSetParameter(vbr->state.enc,
BROTLI_PARAM_LARGE_WINDOW,
settings->large_win) == BROTLI_TRUE);
}
static void
......@@ -618,7 +621,8 @@ coder_init(VRT_CTX, const char *vcl_name, struct vmod_priv *priv,
VCL_VOID
vmod_encoder__init(VRT_CTX, struct vmod_brotli_encoder **encp,
const char *vcl_name, struct vmod_priv *priv,
VCL_STRING filter_name, VCL_BYTES bufsz, VCL_INT quality)
VCL_STRING filter_name, VCL_BYTES bufsz, VCL_INT quality,
VCL_BOOL large_win)
{
struct vmod_brotli_encoder *enc;
struct vfp *vfp = NULL;
......@@ -652,6 +656,7 @@ vmod_encoder__init(VRT_CTX, struct vmod_brotli_encoder **encp,
VRT_AddVFP(ctx, vfp);
settings->which = ENC;
settings->quality = quality;
settings->large_win = large_win;
enc->vfp = vfp;
}
......
......@@ -66,7 +66,8 @@ algorithm for responses fetched from backends.
XXX ...
$Object encoder(PRIV_VCL, STRING name, BYTES bufffer=32768, INT quality=11)
$Object encoder(PRIV_VCL, STRING name, BYTES bufffer=32768, INT quality=11,
BOOL large_win=0)
XXX ...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment