Closed marcinhlybin closed 5 years ago
@ahes you gave the answer yourself. This repository does not support 6.2, but mine does
@ahes you gave the answer yourself. This repository does not support 6.2, but mine does
Why it does not support 6.2? This one is official.
@ahes what would you call "official" with respect to open source software? My repo is the "official" repo for 6.2. Other than that, I can only refer you to the README
@nigoroll By official I mean owned by Varnish Software and referenced in official Varnish documentation. I need to add if
conditional to my VCL to check content of multiple headers (like Set-Cookie). Header vmod does that. On vmod page I can see a link to this repo (no VCC 6.2 though). That is why I refer to this repository as official.
Anyway, I can see that you are from UPLEX but forked repositories tend to be abandoned, not updated, and not merged. I am automating varnish-modules deb package creation and I would prefer to use "official" varnish github repository.
For some reason packagecloud varnish apt repository does not include varnish-modules
package which would come in handy. For example Ubuntu does that with Varnish 5.x.
Did you try to PR your changes?
Maybe adding varnish-modules package would be possible? Are you able to make it happen?
I have pushed an update to http://varnish-cache.org/vmods/ to contain a link to my repo for the cookie vmod. The other vmods contained in varnish-modules were not referenced there, so I only updated that one reference.
On your other points:
Sounds cool. Regarding prejudice, don't worry about that. That's my opinion based on personal observations. YMMV. I am not pointing you nor your repository in particular.
Take care, thanks for replying.
@ahes I understand your worry regarding a switch to a fork with the risk that it would bit-rot. However @nigoroll has tried to force 6.1 support onto us when it got released and has so far kept a good maintenance of his fork as far as I can tell.
Also with my Varnish Software hat on I should warn you against running 6.2 in production as it is uncertain today how much maintenance it will get once the next major release is out. You can get in contact with UPLEX for that kind of support, I assume.
Otherwise we have our own commercial offering, and in addition we picked 6.0 as the latest LTS release.
Our collection of VMODs is relatively low traffic, we certainly fix bugs when we are made aware of them but new features rarely appear. Maybe new VMODs will land in the future, or go away like vmod-softpurge
(we upstreamed a vmod-purge
directly available in Varnish instead).
While I personally want this repository to support all 6.x releases, going beyond 6.0 is currently not a priority.
I will redirect future discussions on this topic to #138.
@Dridi Thank you for clarifying.
Perhaps that is not the best time or place to ask but I am wondering why Varnish does not support handling multiple headers natively. I guess it is a common use case to search for a key pattern in Set-Cookie/Cookie headers.
Currently, below conditional will look only in the first header found which is unexpected behavior (at least for me):
if (beresp.http.Set-Cookie ~ "my_cookie_key=") {
set beresp.uncachable = true;
}
To handle it correctly one would have to use header vmod:
if (header.get(beresp.http.Set-Cookie, "my_cookie_key=")) {
set beresp.uncachable = true;
}
While experimenting I came across std.collect()
. That is interesting because I would expect that it returns a value but instead it modifies a header in place.
It would be really cool if I could just do:
if (std.collect(beresp.http.Set-Cookie, ";") ~ "my_cookie_key=") {
set beresp.uncachable = true;
}
or even:
set beresp.http.X-Set-Cookie = std.collect(beresp.http.Set-Cookie, ";");
if (beresp.http.X-Set-Cookie ~ "my_cookie_key=") {
set beresp.uncachable = true;
}
I guess the crux of it right now is that we don't have a nice syntax in pure VCL to handle multiple headers with the same name, and didn't find a satisfying API to ship such a module with Varnish itself.
And it's a violation of the "spec" [1] to send multiple cookie headers in HTTP/1 and it's either mandatory [2] or recommended for h2. But for h2 we collect the cookies prior to entering vcl_recv
. Arguably we could do the same for HTTP/1.
This is rather a topic for the Varnish mailing lists, so don't open a github issue on this topic or it is guaranteed to be closed as invalid.
Also if you want to collect cookies the separator [3,4] is "; "
with a single trailing SP. HTTP cookies are a mess, make sure to read the RFC with an empty stomach and don't look too closely at header compression in h2 with cookies in mind.
Finally, it may not look obvious from my previous comment, but @nigoroll's past contributions have always been very helpful and future contributions from anyone are reviewed and considered. So thank you @nigoroll and everyone else ;-)
[1] more like a GCD of observed behavior in the wild
[2] I'm sure it's mandatory but I'm not checking the RFC right now
[3] set-cookie-string = cookie-pair *( ";" SP cookie-av )
[4] cookie-string = cookie-pair *( ";" SP cookie-pair )
Bunch of compiler errors while running
make
. This fork seems to solve this issue in branch6.2
: https://github.com/nigoroll/varnish-modules.git