Willy,
On 4/19/21 3:54 PM, Willy Tarreau wrote:
I would advice against making them into converters, because it forces the
user to think about the appropriate fetch to use. As an example the
path-strip-dotdot normalizer probably should not be applied to the query
string! The actions hide this type of detail from the user which I consider
to be a good thing.
I disagree with this line of reasoning, because developers must never
decide what users need (and that's something very difficult to do). We
must only help to figure what users really need (compared to what they
ask for), and estimate the technical feasibility and the consistency
with all other parts so that each feature doesn't look like it's been
developed differently.
ack. My personal experience is mostly with less experienced end users vs
system administrators and I constantly have to prevent those end users
from shooting themselves into the foot. That's why I try to develop safe
interfaces where one is unable to do something that might hurt them due
to them not knowing all the fine details.
Each time we tried to impose something it resulted in a specific feature
being corner-cased over time after we had to implement something cleaner
to put an end to horrible workarounds, just like we've seen a lot of
dummy headers being used before variables existed, or headers appended
after the HTTP version in health checks.
I already have counter examples for you here. Imagine I want to normalize
the Referer header in a request. What I'll have to do is:
http-request set-var(req.uri) url
http-request set-uri req.fhdr(referer)
http-request normalize-uri path-merge-slashes
http-request normalize-uri path-strip-dotdot
http-request set-header referer url
http-request set-uri var(req.uri)
Okay, fair point. This is a good counter example.
I perfectly understand that some transformations may require the whole
URI for various reasons, but for those that could be expressed on
individual parts, I do think that converters will be way more flexible
over the long term.
Luckily this should be easy enough with the clear split between the
action and the actual normalizers that simply take an ist.
There's no rush on this, but I think it's something to keep in mind,
to see which ones might be separated and be provided as converters
as well. We may do that during 2.5-dev and possibly backport them
if there is some demand.
Best regards
Tim Düsterhus