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

2016-11-30 Thread Dridi Boukelmoune
> I think we all agree that there should be a way to go to vcl_backend_error
> from the other 2 backend subroutines.

For completeness, I did not agree to that yesterday because I'd rather
keep error handling separate from artificial responses. I don't have
fond memories of vcl_error days.

___
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev


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

2016-11-30 Thread Federico Schwindt
On Wed, Nov 30, 2016 at 9:24 AM, Dridi Boukelmoune  wrote:

> [..]
> > While this is feasible, I sill don't understand why we would need a
> de-tour over
> > v_b_e just to create a synthetic body.
>
> The problem with using v_b_e is that you need to trick Varnish to get
> there on purpose
>

I think we all agree that there should be a way to go to vcl_backend_error
from the other 2 backend subroutines.
___
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

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

2016-11-30 Thread Nils Goroll
On 29/11/16 21:45, Federico Schwindt wrote:
> I will not object "unset beresp.body" but setting the body in the middle of
> vcl_backend_response{} feels odd to me.

This seems to be the item with the least consensus.

For the use case of replacing the body while keeping headers, the alternative is

- copy response headers to bereq or
  - use a vmod to save them
- resurrect them in v_b_e

While this is feasible, I sill don't understand why we would need a de-tour over
v_b_e just to create a synthetic body.

Why would we

- want  unset beresp.body;
- but not set beresp.body;

?

Both need to abort the backend connection or drain the request in progress, the
only difference would be if we end up with an empty ws non-empty object.

Nils

P.S.: Actually this is something which worked in varnish2, where one could just
call synthetic in vcl_fetch

___
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev


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

2016-11-29 Thread Federico Schwindt
On Tue, Nov 29, 2016 at 3:30 PM, Nils Goroll  wrote:

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

set (be)resp.body is already supported, but restricted to vcl_backend_error
/ vcl_synth.
I did not retire it to maintain compatibility and because I'm was, and
still am, unclear as to what the future plans are wrt bodies.


> - 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
>

I will not object "unset beresp.body" but setting the body in the middle of
vcl_backend_response{} feels odd to me.


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

Is this the same use case but for hits?
If so, I'm on the opinion of allowing to unset the body but not generating
one, same as above in the vcl_backend_response{} case.


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

I'd object to this. I think the current name is fine and self-explanatory.


> - add status and reason to abandon which get pre-set for the call
>   to vcl_synth
>
>   503 as default
>

+1


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

I'm all for adding return(error(code, reason)) to go to vcl_backend_error{}.
I think this subroutine should not be renamed.


> More thoughts:
>
> - if we want the (un)set beresp.body, should we maybe have
>
> set beresp.body = fetch()
>
>   also?
>

I'd prefer to have a way to express the opposite, as in "unset beresp.body".



>   This would be the default if no other beresp.body action happend
>   in vcl_backend_response
>
> Thanks, Nils
>
> ___
> varnish-dev mailing list
> varnish-dev@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
>
___
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

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

2016-11-29 Thread Nils Goroll
On 29/11/16 16:30, Nils Goroll wrote:
> - generating synthetic content (setting a body) on the backend side is only
>   possible in vcl_backend_error. [...]

Thank you to fgs for pointing our that people who are not following IRC may find
it hard to understand the actual use case I am working on.

It's dead simple: Replace bodies for backend responses which should not be sent
downstream while keeping the original response headers (or at least some).

Nils

___
varnish-dev mailing list
varnish-dev@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev