Commit f82b5f15 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Don't ignore OA_GZIPBITS if there is a boc

Under load, client c4 from g00005.vtc may fail with a 200 response
instead of the expected 206 partial response.

There is a window during which we might still see a boc, but because
c4 sets beresp.do_stream to false, the fetch has to be over. To close
this race we can instead reference the boc as suggested in #2904 and
keep track of the boc state.
parent 8ea006ee
......@@ -42,6 +42,7 @@
#include "cache_varnishd.h"
#include "cache_filter.h"
#include "cache_objhead.h"
#include "cache_vgz.h"
#include "vend.h"
......@@ -288,6 +289,8 @@ static int v_matchproto_(vdp_init_f)
vdp_gunzip_init(struct req *req, void **priv)
{
struct vgz *vg;
struct boc *boc;
enum boc_state_e bos;
const char *p;
ssize_t dl;
uint64_t u;
......@@ -309,8 +312,15 @@ vdp_gunzip_init(struct req *req, void **priv)
req->resp_len = -1;
boc = HSH_RefBoc(req->objcore);
if (boc != NULL) {
bos = boc->state;
HSH_DerefBoc(req->wrk, req->objcore);
} else
bos = BOS_FINISHED;
/* OA_GZIPBITS is not stable yet */
if (req->objcore->boc)
if (bos < BOS_FINISHED)
return (0);
p = ObjGetAttr(req->wrk, req->objcore, OA_GZIPBITS, &dl);
......
......@@ -35,7 +35,7 @@ client c1 {
varnish v1 -vsl_catchup
client c1 {
client c2 {
txreq -hdr "Accept-encoding: gzip;q=0.1"
rxresp
expect resp.http.content-encoding == "gzip"
......@@ -49,7 +49,7 @@ varnish v1 -vsl_catchup
# is completed before we attempt the range request
delay 2
client c1 {
client c3 {
txreq -hdr "Range: bytes=3-5"
rxresp
expect resp.status == 206
......@@ -60,7 +60,7 @@ client c1 {
varnish v1 -vsl_catchup
client c1 {
client c4 {
txreq -url "/nostreamcachemiss" -hdr "Range: bytes=3-5"
rxresp
expect resp.status == 206
......@@ -71,7 +71,7 @@ client c1 {
varnish v1 -vsl_catchup
client c1 {
client c5 {
# simple cache miss, no stream, no gunzip
txreq -url "/nostream2" -hdr "Range: bytes=3-5" -hdr "Accept-Encoding: gzip"
rxresp
......
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