[Varnish] #481: Retain information about backends post-vbe_conn destruction for use in VCL
Varnish
varnish-bugs at projects.linpro.no
Thu Apr 2 17:36:06 CEST 2009
#481: Retain information about backends post-vbe_conn destruction for use in VCL
-------------------------+--------------------------------------------------
Reporter: mbm | Owner: phk
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: varnishd | Version: 2.0
Severity: normal | Keywords: VCL backend
-------------------------+--------------------------------------------------
In the VCL "sub fetch {}" function, it's often useful to get information
about which backend served the request if a director of some sort is being
used. While the vbe_conn is available, this is is in
sp->vbe->backend->vcl_name and the information about IPs and ports is in
the sp->vbe->backend->ipv4 or ipv6 sockaddr*. Unfortunately by the time
the VCL fetch is called, the vbe_conn has been freed, and so sp->vbe is
NULL.
I've attached a patch (including a new varnishtest testcase) for
bereq.backend (which gives the vcl_name element of the backend structure)
and bereq.backend_ip (which gives the IP). I should probably have done a
bereq.backend_port too - but I didn't need it for our situation and I
couldn't work out how to look at the TCL. This isn't as clean as I'd
hoped, as in order to make it available to the session you need
cache_backend.h available in cache_fetch.c, but possibly it's a starting
place, and I think it's useful functionality to have.
--
Ticket URL: <http://varnish.projects.linpro.no/ticket/481>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list