Commit 7c6907a3 authored by Geoff Simmons's avatar Geoff Simmons

Add the decoder param large_win.

parent f3af1ac6
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
varnishtest "test various custom parameter settings" varnishtest "test various custom parameter settings"
server s1 { server s1 {
loop 3 { loop 4 {
rxreq 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.} 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.}
} }
...@@ -81,6 +81,23 @@ varnish v1 -errvcl {vfp brotli failure: new err: quality 12 out of range (0 to 1 ...@@ -81,6 +81,23 @@ varnish v1 -errvcl {vfp brotli failure: new err: quality 12 out of range (0 to 1
} }
} }
# Large window
varnish v1 -vcl+backend {
import ${vmod_brotli};
sub vcl_init {
new mybr = brotli.decoder("unbr_largewin", large_win=true);
}
sub vcl_backend_response {
set beresp.filters = "br unbr_largewin";
set beresp.uncacheable = true;
}
}
client c1 -run
logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" { logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect 0 * Begin bereq expect 0 * Begin bereq
expect * = VfpAcct {^unbr \d+ 269$} expect * = VfpAcct {^unbr \d+ 269$}
...@@ -96,4 +113,9 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" { ...@@ -96,4 +113,9 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VfpAcct" {
expect * = VfpAcct {^unbr \d+ 269$} expect * = VfpAcct {^unbr \d+ 269$}
expect * = VfpAcct {^br_q11 \d+ \d+$} expect * = VfpAcct {^br_q11 \d+ \d+$}
expect * = End expect * = End
expect 0 * Begin bereq
expect * = VfpAcct {^unbr_largewin \d+ 269$}
expect * = VfpAcct {^br \d+ \d+$}
expect * = End
} -run } -run
...@@ -78,6 +78,7 @@ struct vbr_settings { ...@@ -78,6 +78,7 @@ struct vbr_settings {
#define VBR_SETTINGS_MAGIC 0xa61992aa #define VBR_SETTINGS_MAGIC 0xa61992aa
VCL_BYTES bufsz; VCL_BYTES bufsz;
uint32_t quality; uint32_t quality;
uint32_t large_win;
enum vbr_which which; enum vbr_which which;
}; };
...@@ -153,8 +154,10 @@ setEncoderParams(struct vbr *vbr, const struct vbr_settings *settings) ...@@ -153,8 +154,10 @@ setEncoderParams(struct vbr *vbr, const struct vbr_settings *settings)
static void static void
setDecoderParams(struct vbr *vbr, const struct vbr_settings *settings) setDecoderParams(struct vbr *vbr, const struct vbr_settings *settings)
{ {
(void) vbr; CHECK_OBJ_NOTNULL(settings, VBR_SETTINGS_MAGIC);
(void) settings; assert(BrotliDecoderSetParameter(vbr->state.dec,
BROTLI_DECODER_PARAM_LARGE_WINDOW,
settings->large_win) == BROTLI_TRUE);
} }
static inline void static inline void
...@@ -675,7 +678,7 @@ vmod_encoder__fini(struct vmod_brotli_encoder **encp) ...@@ -675,7 +678,7 @@ vmod_encoder__fini(struct vmod_brotli_encoder **encp)
VCL_VOID VCL_VOID
vmod_decoder__init(VRT_CTX, struct vmod_brotli_decoder **decp, vmod_decoder__init(VRT_CTX, struct vmod_brotli_decoder **decp,
const char *vcl_name, struct vmod_priv *priv, const char *vcl_name, struct vmod_priv *priv,
VCL_STRING filter_name, VCL_BYTES bufsz) VCL_STRING filter_name, VCL_BYTES bufsz, VCL_BOOL large_win)
{ {
struct vmod_brotli_decoder *dec; struct vmod_brotli_decoder *dec;
struct vfp *vfp = NULL; struct vfp *vfp = NULL;
...@@ -701,6 +704,7 @@ vmod_decoder__init(VRT_CTX, struct vmod_brotli_decoder **decp, ...@@ -701,6 +704,7 @@ vmod_decoder__init(VRT_CTX, struct vmod_brotli_decoder **decp,
vfp->pull = vfp_unbr_pull; vfp->pull = vfp_unbr_pull;
VRT_AddVFP(ctx, vfp); VRT_AddVFP(ctx, vfp);
settings->which = DEC; settings->which = DEC;
settings->large_win = large_win;
dec->vfp = vfp; dec->vfp = vfp;
} }
......
...@@ -70,7 +70,7 @@ $Object encoder(PRIV_VCL, STRING name, BYTES bufffer=32768, INT quality=11) ...@@ -70,7 +70,7 @@ $Object encoder(PRIV_VCL, STRING name, BYTES bufffer=32768, INT quality=11)
XXX ... XXX ...
$Object decoder(PRIV_VCL, STRING name, BYTES buffer=32768) $Object decoder(PRIV_VCL, STRING name, BYTES buffer=32768, BOOL large_win=0)
XXX ... 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