BUG/MINOR: http-rules: Replace path and query-string in "replace-path" action
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 31 Aug 2020 14:27:42 +0000 (16:27 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 1 Sep 2020 12:39:42 +0000 (14:39 +0200)
commit7d360ab50f5201c617c7f93d7c973cf284f3a0b4
treef059972ff33190322702f4478c92edfccbd84d23
parente2d1d0c9bceae58155d15f47252a8e47517f3d93
BUG/MINOR: http-rules: Replace path and query-string in "replace-path" action

The documentation stated the "replace-path" action replaces the path, including
the query-string if any is present. But in the code, only the path is
replaced. The query-string is preserved. So, now, instead of relying on the same
action code than "set-uri" action (1), a new action code (4) is used for
"replace-path" action. In http_req_replace_stline() function, when the action
code is 4, we call http_replace_req_path() setting the last argument (with_qs)
to 1. This way, the query-string is not skipped but included to the path to be
replaced.

This patch relies on the commit b8ce505c6 ("MINOR: http-htx: Add an option to
eval query-string when the path is replaced"). Both must be backported as far as
2.0. It should fix the issue #829.

(cherry picked from commit 4b9c0d1fc08388bf44c6ebbd88f786032dd010fc)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 984435789b5aee02671005ad9f098847bbb60a61)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/http_act.c
src/http_ana.c