Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delivery: http1 chunked encoding trailers support & other improvements #4

Closed
wants to merge 11 commits into from

Conversation

nigoroll
Copy link
Owner

Continuing and based upon #3

Please read the individual commit messages. Overall, the changes are:

  • varnishtest support for chunk trailers
  • writing trailers downstream with chunked encoding
  • basic support in cache_http

commits most relevant regarding interfaces:

  • 2300e34 is a minimalistic "mvp" interface included here only as a reference point for reviewers
  • e44c1ea is a suggestion for full-blown VRT support to access trailers from esi_level > 0 as resp_top.http.*
    The latter requires introduction of run time header access control to VRT which is suggested as a reference/dereference pattern replacing VRT_selecthttp()

- select chunked encoding if Trailers present
- mark where trailers start
- update trailer start for unset
- assert elsewhere
Analogous to req_top, we add resp_top to access the top-level response
headers from esi_level > 0. Write access produces chunked trailers if
allowed as indicated by resp.http.Trailer on esi level 0.

This requires a fundamental change to error handling: We cannot allow
writes to resp_top from esi_level 0 outside vcl_deliver / synth (it
does not exist yet), so we introduce runtime error checking for header
access: Callers of vrt have to acquire permission before using a
struct http, which might fail.

Foreseeing concurrent access to headers, the new interface is
ref/deref via VRT_http_(de)?ref_(ro|rw).

Added benefit is that VRT_http_ref_ro, the successor of
VRT_selecthttp() now returns a const.

Reflecting on the run-time access: we current do allow writes to
resp.http from esi_level > 0, which I guess has been counter-intuitive
to almost any varnish user at some point because any such changes have
zero effect.

So most likely, our users run a lot of vcl_deliver code with esi for
just nothing except confusion. Should we go for runtime access
checking, we might as well forbid write access to resp.http for
esi_level > 0. (see #ifdef XXX_CONSIDER_THIS in cache_vrt.c)
So if it happened to have been set before, make it a trailer. This actually
enables Unsetting trailers
@nigoroll
Copy link
Owner Author

continued in #6

@nigoroll nigoroll closed this Nov 23, 2017
@nigoroll nigoroll deleted the trailers_delivery5 branch April 5, 2018 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant