Le 08/04/2021 à 20:59, Tim Duesterhus a écrit :
Willy,
Christopher,
Not sure who of you is better suited to review this series, so I'm adding both
of you :-)
I'm tagging this as RFC, because it's large and quite a bit outside of my
comfort zone. However the patches are as clean as possible. They include full
documentation and each normalizer comes with a bunch of reg-tests ensuring they
behave like I expect them to behave. So if you have nothing to complain, then
this series is in a mergeable state. I plan to add a few more normalizers after
this passes an initial review.
I'll add additional remarks to each patch, explaining my decisions in more
detail.
Best regards
Tim Düsterhus (8):
MINOR: uri_normalizer: Add uri_normalizer module
MINOR: uri_normalizer: Add `http-request normalize-uri`
MINOR: uri_normalizer: Add a `dotdot` normalizer to http-request
normalize-uri
MINOR: uri_normalizer: Add a `sort-query` normalizer
OPTIMIZE: uri_normalizer: Optimize allocations in
uri_normalizer_query_sort
MINOR: uri_normalizer: Add support for supressing leading `../` for
dotdot normalizer
MINOR: uri_normalizer: Support returning detailed errors from uri
normalization
MINOR: uri_normalizer: Add a `percent-upper` normalizer
Makefile | 3 +-
doc/configuration.txt | 58 +++++
include/haproxy/action-t.h | 9 +
include/haproxy/uri_normalizer-t.h | 32 +++
include/haproxy/uri_normalizer.h | 33 +++
reg-tests/http-rules/normalize_uri.vtc | 314 +++++++++++++++++++++++++
src/http_act.c | 213 +++++++++++++++++
src/uri_normalizer.c | 298 +++++++++++++++++++++++
8 files changed, 959 insertions(+), 1 deletion(-)
create mode 100644 include/haproxy/uri_normalizer-t.h
create mode 100644 include/haproxy/uri_normalizer.h
create mode 100644 reg-tests/http-rules/normalize_uri.vtc
create mode 100644 src/uri_normalizer.c
Tim,
Sorry for the delay. I'll comment your patches by replying inline when
appropriate. The quality of the whole series is pretty good. Thanks for the
effort. Just a suggestion to simplify the error handling introduced in the 7th
patch. You may use following prototype for your normalizers:
int uri_normalizer_NAME(const struct ist path, struct ist *dst);
returning for instance 0 on success and anything else on error. This way, it is
easy to return an enum instead of an integer to be able to handle errors.
--
Christopher Faulet