]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: http-fetch: Add an option to 'query" to get the QS with the '?'
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 15 Nov 2024 16:25:47 +0000 (17:25 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 20 Nov 2024 09:20:05 +0000 (10:20 +0100)
commit17d4e6eaf9f5fa5f13fad74b76ec2d31408abf6a
tree67c041404ef3852a07e6d5a8a5ace01da569a6d6
parent2a5da31ccef239e21d17ec34430fdc6b51b9cc67
MINOR: http-fetch: Add an option to 'query" to get the QS with the '?'

As mentionned by Thayne McCombs in #2728, it could be handy to have a sample
fetch function to retrieve the query string with the question mark
character.

Indeed, for now, "query" sample fetch function already extract the query
string from the path, but the question mark character is not
included. Instead of adding a new sample fetch function with a too similar
name, an optional argument is added to "query". If "with_qm" is passed as
argument, the question mark will be included in the query string, but only
if it is not empty.

Thanks to this patch, the following rule:

  http-request redirect location /destination?%[query] if { -m found query }  some_condition
  http-request redirect location /destination if some_condition

can now be expressed this way:

  http-request redirect location /destination%[query(with_qm)] if some_condition
doc/configuration.txt
src/http_fetch.c