thoughts about vcl cleanup around (be)resp.body and abandon/synth

Nils Goroll slink at schokola.de
Tue Nov 29 16:30:44 CET 2016


Hi,

it appeared to me that VCL is cumbersome for handling body replacement on the
backend side and the behavior of abandon from the client side is confusing.

Current status:

- generating synthetic content (setting a body) on the backend side is only
  possible in vcl_backend_error. To get there, we need to reach the max
  retries or trigger a fetch error. To tell vcl_backend_error what to do,
  we need markers in bereq.http.*

- return(abandon) fails the backend request and ends up on the client side,
  but we can't tell the client side what to do

Suggestion:

- retire synthetic and support (un)set (be)resp.body
  (not directly related to the topic, but something we should do
   for consistency)

- add support for (un)set beresp.body to vcl_backend_response
  if used:
  -> short-term: silently abort the backend connection
  -> better: discard-read the response body

- add support for (un)set resp.body to vcl_deliver

- rename vcl_backend_error to vcl_backend_synth to be consistent
  with the client side

- add status and reason to abandon which get pre-set for the call
  to vcl_synth

  503 as default

- add return(backend_synth(status, reason)) to vcl_backend_fetch
  as an easy way to return synthetic content at backend request
  time.

More thoughts:

- if we want the (un)set beresp.body, should we maybe have

	set beresp.body = fetch()

  also?

  This would be the default if no other beresp.body action happend
  in vcl_backend_response

Thanks, Nils



More information about the varnish-dev mailing list