vcl_init, VMODs & workspaces

Carlos Abalde carlos.abalde at
Tue May 3 21:32:40 CEST 2016

Hi all,

I'm working on a VMOD (VC 4.1) and I would like to create a simple function able to return string values. You can think these strings as values of variables previously set somewhere else (e.g. environment variables) and used during vcl_init to make some decisions.

This would be trivial stuff outside of vcl_init (i.e. return WS_Copy(ctx->ws, "whatever", -1)), but ctx->ws is not available during vcl_init. Is there any friendly alternative not requiring the VMOD doing explicit mallocs when returning strings, keeping track of returned pointers, and releasing them when execution of vcl_init is completed?


Carlos Abalde

More information about the varnish-dev mailing list