For subrequests, reference the zipflow_request via the transport_priv

this way, it survives label switching
parent 730b05fb
......@@ -44,6 +44,22 @@
#include "vcc_zipflow_if.h"
#include "zfr_iter.h"
static void v_matchproto_(vtr_deliver_f)
zfr_deliver(struct req *req, struct boc *boc, int wantbody);
static void v_matchproto_(vtr_reembark_f)
zfr_reembark(struct worker *wrk, struct req *req);
static int v_matchproto_(vtr_minimal_response_f)
zfr_minimal_response(struct req *req, uint16_t status);
//lint -e{785} too few initializers
static const struct transport ZIPFLOW_transport = {
.magic = TRANSPORT_MAGIC,
.name = "ZIPFLOW",
.deliver = zfr_deliver,
.reembark = zfr_reembark,
.minimal_response = zfr_minimal_response
};
static void __attribute__((constructor))
assert_zlib(void)
{
......@@ -187,6 +203,16 @@ get_zipflow_request(VRT_CTX)
struct vmod_priv *task_priv;
struct zipflow_request *zfr;
struct zipflow_top *zft;
struct req *req;
req = ctx->req;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
if (req->transport == &ZIPFLOW_transport) {
CAST_OBJ_NOTNULL(zfr, req->transport_priv,
ZIPFLOW_REQUEST_MAGIC);
return (zfr);
}
task_priv = VRT_priv_task(ctx, zipflow_request_priv);
if (task_priv == NULL) {
......@@ -797,18 +823,6 @@ zfr_minimal_response(struct req *req, uint16_t status)
return (0);
}
static void v_matchproto_(vtr_deliver_f)
zfr_deliver(struct req *req, struct boc *boc, int wantbody);
//lint -e{785} too few initializers
static const struct transport ZIPFLOW_transport = {
.magic = TRANSPORT_MAGIC,
.name = "ZIPFLOW",
.deliver = zfr_deliver,
.reembark = zfr_reembark,
.minimal_response = zfr_minimal_response
};
/*--------------------------------------------------------------------
* basically varnish-cache ESI
*/
......@@ -819,8 +833,6 @@ zfr_include(struct req *preq, struct zipflow_request *zfr)
struct worker *wrk;
struct sess *sp;
struct req *req;
struct vmod_priv *task_priv;
struct vrt_ctx ctx[1];
enum req_fsm_nxt s;
const char *h;
......@@ -899,14 +911,7 @@ zfr_include(struct req *preq, struct zipflow_request *zfr)
req->transport = &ZIPFLOW_transport;
req->transport_priv = zfr;
CNT_Embark(wrk, req);
VCL_TaskEnter(req->privs);
INIT_OBJ(ctx, VRT_CTX_MAGIC);
VCL_Req2Ctx(ctx, req);
task_priv = VRT_priv_task(ctx, zipflow_request_priv);
AN(task_priv);
AZ(task_priv->priv);
task_priv->priv = zfr;
AZ(zfr->cond);
zfr->cond = &wrk->cond;
......
......@@ -21,6 +21,10 @@ varnish v1 -vcl+backend {
}
}
sub vcl_deliver {
set resp.http.is-subreq = zipflow.is_subreq();
}
sub synth_zipflow {
if (zipflow.is_subreq()) {
return;
......
......@@ -21,6 +21,10 @@ varnish v1 -vcl+backend {
}
}
sub vcl_deliver {
set resp.http.is-subreq = zipflow.is_subreq();
}
sub synth_zipflow {
if (zipflow.is_subreq()) {
return;
......
......@@ -23,6 +23,7 @@ varnish v1 -vcl {
}
sub synth_sub {
set resp.http.is-subreq = zipflow.is_subreq();
synthetic("sub " + req.url);
}
......
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