...
 
Commits (6)
......@@ -200,14 +200,14 @@ this issue, and of possible solutions with VCL.
.. _vmod_brotli.encoder:
new xencoder = brotli.encoder(STRING name, BYTES bufffer, INT quality, BOOL large_win, INT lgwin, ENUM mode)
------------------------------------------------------------------------------------------------------------
new xencoder = brotli.encoder(STRING name, BYTES buffer, INT quality, BOOL large_win, INT lgwin, ENUM mode)
-----------------------------------------------------------------------------------------------------------
::
new xencoder = brotli.encoder(
STRING name,
BYTES bufffer=32768,
BYTES buffer=32768,
INT quality=11,
BOOL large_win=0,
INT lgwin=22,
......
......@@ -69,17 +69,16 @@ varnish v1 \
}
sub br_recv {
unset req.http.V-A-E;
if (local.socket == "self_plain") {
unset req.http.V-A-E;
unset req.http.O-A-E;
set req.hash_ignore_busy = true;
if (req.http.Is-Bgfetch == "true") {
set req.grace = 0s;
}
return (hash);
}
if (req.restarts == 0) {
} else if (req.restarts == 0) {
unset req.http.V-A-E;
unset req.http.O-A-E;
if (req.http.Accept-Encoding) {
set req.http.O-A-E = req.http.Accept-Encoding;
}
......@@ -125,6 +124,9 @@ varnish v1 \
unset beresp.http.X-TTL;
} else {
set beresp.uncacheable = true;
if (beresp.ttl < 10s) {
set beresp.ttl = 10s;
}
}
return (deliver);
}
......@@ -144,16 +146,14 @@ varnish v1 \
}
sub br_deliver {
unset resp.http.X-TTL;
# for ESI:
# if (objesi.is_esi() || obj.uncacheable)
if (obj.uncacheable) {
# NOP
} else if (local.socket == "self_plain") {
if (obj.uncacheable) {
unset resp.http.X-TTL;
} else {
set resp.http.X-TTL = obj.ttl;
}
set resp.http.X-TTL = obj.ttl;
} else {
unset resp.http.X-TTL;
if (resp.http.Vary ~ "\bV-A-E\s*,") {
set resp.http.Vary = regsub(resp.http.Vary,
"\bV-A-E\s*,\s*", "");
......
......@@ -23,7 +23,21 @@ Enim per accumsan, augue id maecenas bibendum ullamcorper in fermentum, platea f
rxreq
txresp -nolen -hdr "Transfer-encoding: chunked"
chunkedlen 131072
chunkedlen 8
chunkedlen 8
chunkedlen 16
chunkedlen 32
chunkedlen 64
chunkedlen 128
chunkedlen 256
chunkedlen 512
chunkedlen 1024
chunkedlen 2048
chunkedlen 4096
chunkedlen 8192
chunkedlen 16384
chunkedlen 32768
chunkedlen 65536
chunkedlen 0
} -start
......
......@@ -49,7 +49,7 @@
VRT_fail((ctx), "vfp brotli failure: " fmt, __VA_ARGS__)
/* cf. varnishd default gzip_buffer */
#define DEFAULT_BUFSZ (32 * 1024 * 1024)
#define DEFAULT_BUFSZ (32 * 1024)
struct vbr_stream {
const uint8_t *next_in;
......@@ -70,8 +70,8 @@ struct vbr {
BrotliDecoderState *dec;
} state;
uint8_t *buf;
size_t bufsz;
size_t buflen;
ssize_t bufsz;
ssize_t buflen;
enum vbr_which which;
};
......@@ -386,7 +386,7 @@ vfp_br_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
ssize_t *lenp)
{
struct vbr *vbr;
ssize_t len, dl;
ssize_t len, l, dl;
enum vfp_status vp = VFP_ERROR;
int finished = 0;
BROTLI_BOOL done;
......@@ -407,8 +407,12 @@ vfp_br_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
do {
if (isInputBufEmpty(vbr)) {
len = vbr->bufsz;
vp = VFP_Suck(ctx, vbr->buf, &len);
len = 0;
do {
l = vbr->bufsz - len;
vp = VFP_Suck(ctx, vbr->buf + len, &l);
len += l;
} while (vp == VFP_OK && len < vbr->bufsz);
if (vp == VFP_ERROR)
break;
if (vp == VFP_END)
......@@ -439,7 +443,7 @@ vfp_unbr_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
ssize_t *lenp)
{
struct vbr *vbr;
ssize_t len, dl;
ssize_t len, l, dl;
enum vfp_status vp = VFP_ERROR;
BrotliDecoderResult result = BROTLI_DECODER_RESULT_ERROR;
const struct vfp_priv *priv;
......@@ -459,8 +463,12 @@ vfp_unbr_pull(struct vfp_ctx *ctx, struct vfp_entry *ent, void *ptr,
do {
if (isInputBufEmpty(vbr)) {
len = vbr->bufsz;
vp = VFP_Suck(ctx, vbr->buf, &len);
len = 0;
do {
l = vbr->bufsz - len;
vp = VFP_Suck(ctx, vbr->buf + len, &l);
len += l;
} while (vp == VFP_OK && len < vbr->bufsz);
if (vp == VFP_ERROR)
break;
setInputBuf(vbr, vbr->buf, len);
......
......@@ -200,7 +200,7 @@ Note that (unlike gzip) brotli compression does not work together with
Edge Side Includes (ESI). See `LIMITATIONS`_ below for a discussion of
this issue, and of possible solutions with VCL.
$Object encoder(PRIV_VCL, STRING name, BYTES bufffer=32768, INT quality=11,
$Object encoder(PRIV_VCL, STRING name, BYTES buffer=32768, INT quality=11,
BOOL large_win=0, INT lgwin=22,
ENUM {GENERIC, TEXT, FONT} mode=GENERIC)
......