The URI parser looked for the last '?' of the URI instead of the first
one, so only the arguments after the last '?' were used. The example
of the documentation and of the help page, "/?r=500?s=0?c=0?t=1000",
thus only applied "t=1000" and returned a 200. httpterm used the first
'?', and the arguments loop already accepts '?' as a delimiter between
arguments, like '&', ',', ';' and '/'.
Let's stop at the first '?'.
This was introduced with haterm by commit
c9d47804d ("MINOR: haterm:
add haterm HTTP server"), so it should be backported to 3.4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aleksandar Lazic <al-haproxy@none.at>
/* we'll check for the following URIs :
* /?{s=<size>|r=<resp>|t=<time>|c=<cache>}[&{...}]
* /? to get the help page.
+ * The arguments start after the first '?', the next ones are
+ * delimiters like '&'.
*/
- while (p < end)
- if (*p++ == '?')
+ while (p < end) {
+ if (*p++ == '?') {
next = p;
+ break;
+ }
+ }
if (next) {
arg = next;