bo access from VFP

Dridi Boukelmoune dridi at varni.sh
Mon Jan 3 15:57:47 UTC 2022


On Fri, Dec 31, 2021 at 11:48 PM Guillaume Quintard
<guillaume.quintard at gmail.com> wrote:
>
> Small follow-up on that one: it would be nice for VFP to be able to disable streaming (bo->do_stream), so that's an extra argument to be able to access the busyobj
>
> --
> Guillaume Quintard
>
>
> On Sun, Dec 26, 2021 at 6:11 PM Guillaume Quintard <guillaume.quintard at gmail.com> wrote:
>>
>> Happy holidays to everyone,

Happy new year !

>> Unless I'm mistaken, there's no way for a VFP to access the busyobj, and was wondering if that could change as I need it to retrieve a vmod_priv.

I think your statement is correct.

>> For some context, I stumbled on this while working on this vmod: https://github.com/gquintard/vmod_rers/tree/v0.0.2
>> (It's in rust, and I'm using it to explore what kind of bindings we need. I already have a couple of examples for VDP[1] and VFP[2] in the crate[3] repo, but of course they don't need as much as a real vmod.)
>>
>> With vmod_rers, the user is able to add regex/sub pairs on a per-request basis [4], and they will be acted upon by the VDP. To store and retrieve the pairs I use the regular "fake vrt_ctx trick"[4], since the VDP has access to the req struct, it's very easy to build.
>> However, I'm unable to do the same thing on the VFP side since I have neither a req (fair) nor a bo.

The big difference between both is that we only use VDPs to deliver
client responses, but we use VFPs to fetch both beresp and req bodies,
so the VFP operates at the objcore level.

>> Is there a big reason for not having access to it, or is it just that nobody asked for it until now?

Probably nobody never asked for it?

Passing a VRT_CTX to the VFP init function could help grab a req or bo
and stash it in vfp_entry::priv1, but I don't see a way to do that
today without cheating.

*cough* THR_GetBusyobj() *cough*

Cheers,
Dridi


More information about the varnish-dev mailing list