• Nils Goroll's avatar
    Support copying PRIV_TASKs from the client to the backend side · 6a1bd719
    Nils Goroll authored
    Until now, more or less the only option to copy data from the VCL
    client side to the backend side is through headers, as `bereq.http` is
    initialized as a copy of `req.http` (additions to this are the
    recently changed `client.identity` and `req.backend_hint`).
    
    We now add the option for vmods to register a callback per `PRIV_TASK`
    which can then be used to copy vmod owned data from the client to the
    backend side.
    
    Callback registrations are kept on a list hanging off `struct req` on
    demand. When a backend request is created, the registered functions
    are called in order of registration.
    
    The base memory cost to this is one pointer added to `struct req`. If
    no registrations are used, this is the only impact on memory
    requirements.
    The runtime overhead when no callbacks are registered is close to a
    noop: one function call to `vbf_privs_copy()`, which only checks a
    pointer (besides the common `CHECK_OBJ_*` argument checks).
    
    Alternatives considered:
    
    A straight forward alternative would be a per `PRIV_TASK` copy
    function pointer paralleling the free pointer. This option would
    charge every `PRIV_TASK` with an additional pointer. Under the
    assumption that `PRIV_TASK` copy operations will be required for
    select data only, this option was dismissed. It should be noted though
    that this option could be more memory efficient if a relevant
    proportion of `PRIV_TASKs` requested copying (one pointer vs. approx 4
    pointers for this solution).
    
    Another option was to add an event signalled to vmods for backend
    request creation (basically `STP_MKBEREQ`). This would allow for the
    same functionality as proposed here, but vmods would be responsible to
    track all `PRIV_TASK`s requiring copying themsevles. This tracking
    would be similar to what is suggested herein, but without the reuse.
    6a1bd719
Name
Last commit
Last update
..
compat Loading commit data...
tbl Loading commit data...
vapi Loading commit data...
Makefile.am Loading commit data...
generate.py Loading commit data...
libvcc.h Loading commit data...
miniobj.h Loading commit data...
vas.h Loading commit data...
vav.h Loading commit data...
vbh.h Loading commit data...
vbm.h Loading commit data...
vbm_test.c Loading commit data...
vcc_interface.h Loading commit data...
vcli.h Loading commit data...
vcli_serve.h Loading commit data...
vcs.h Loading commit data...
vct.h Loading commit data...
vcurses.h Loading commit data...
vdef.h Loading commit data...
venc.h Loading commit data...
vend.h Loading commit data...
vev.h Loading commit data...
vfil.h Loading commit data...
vfl.h Loading commit data...
vin.h Loading commit data...
vjsn.h Loading commit data...
vlu.h Loading commit data...
vmb.h Loading commit data...
vnum.h Loading commit data...
vpf.h Loading commit data...
vqueue.h Loading commit data...
vre.h Loading commit data...
vrnd.h Loading commit data...
vrt.h Loading commit data...
vsa.h Loading commit data...
vsb.h Loading commit data...
vsc_priv.h Loading commit data...
vsha256.h Loading commit data...
vsl_priv.h Loading commit data...
vsm_priv.h Loading commit data...
vss.h Loading commit data...
vsub.h Loading commit data...
vtcp.h Loading commit data...
vtim.h Loading commit data...
vtree.h Loading commit data...
vus.h Loading commit data...
vut.h Loading commit data...
vut_options.h Loading commit data...