feasability of adding field to sess struct
John Skopis
jspam at skopis.com
Fri Feb 17 20:52:30 CET 2012
Hi,
I posted to varnish-misc recently asking how I might be able to
propgate the http status code from an esi subrequest to the parent
request, ie esi beresp.status is 5xx, set resp.status to 5xx in
vcl_deliver.
At this point I am pretty sure its not possible.
I am wondering if the best way to make it possible is to add a member
to struct sess { int esi_status; }?
What I was thinking was that somewhere there is a function that sets
up a session where wsi_status would be initialized to 200. Somewhere
there is a function that does the fetch, in which I would check the
http status and if it's not 200 updating esi_status on the session.
Additionally I would expose esi_status for reading and writing in vcl.
For me at least the canonical way to use esi_status in vcl would be to
check if the http response is in an esi context (using a header set by
the backend) and possibly override the esi_status, and ultimately set
the resp.status to req.esi_status.
I am not too familiar with the varnish source and before I jump into
the magic that is the varnish FSM I am wondering
Would you do this?
Is there a better way?
How might I go about doing this?
I am not sure if esi requests are synchronous or not. Is a mutex
required to update the esi_status on the session?
Anything else?
Thanks,
John
More information about the varnish-dev
mailing list