varnishcache / varnish-cache

Varnish Cache source code repository
https://www.varnish-cache.org
Other
3.68k stars 377 forks source link

IP and REGEX literals for vcl 4.1? #2615

Closed dridi closed 6 years ago

dridi commented 6 years ago

After a discussion with @nigoroll in varnish-hacking:

18:40 < slink> did we ever consider literal ip addresses in vcl? 18:40 < slink> it feels odd having no sensible fallback for std.ip 19:21 < dridi> slink: i agree, it would be nice to just say "x.x.x.x" or the ipv6 equivalent 19:21 < dridi> or fwiw, possibly even a domain name 19:21 < dridi> we already do that for backend .host 19:22 < dridi> a constant string resolved a compile time 19:22 < slink> um not sure if I like that, but it would probably be convenient for many cases 19:22 < dridi> we do that for regular expressions 19:22 < dridi> we write them as string literals 19:22 < slink> true 19:23 < dridi> not as /regex-literals/ like other languages with built-in regex support 19:23 < slink> yes 19:23 < dridi> although i wouldn't mind regex literals for regex flags 19:24 < dridi> eg. if (req.http.host ~ /(.\.)acme\.com/i) { ... } 19:25 < slink> also true 19:26 dridi throws booleans everywhere 19:26 < dridi> slink: github issue for next bugwash? sounds like vcl 4.1 material 19:27 < slink> I don't feel that much pain about it, so I'd tend to consider other VIPs a priority, but would be nice to get back to it 19:28 < slink> IF we opened the regex wormcan, I'd throw in back references 19:28 < dridi> slink: if we discuss it next bugwash it can turn into a vip for later 19:28 < slink> (basically integrating vmod_re) 19:28 < slink> feel free to take a gh note 19:28 < dridi> at least we'd have a formal document to refer to later 19:28 < slink> that seems to have become the new fashion ;) 19:29 < dridi> ok, will lazily do

Maybe we need a label c=vcl for github issues, we may see more tickets related to vcl 4.1 from now on.

bsdphk commented 6 years ago

Unconvincing, for the complexity involved.

nigoroll commented 6 years ago

set resp.http.foo1 = std.ip("..", "1.2.3.4"); works. no good reason for changing regexp syntax