mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
[MINOR] http: fix double slash prefix with server redirect
When using server redirection, it is possible to specify a path
consisting of only one slash. While this is discouraged (risk of
loop) it may sometimes be useful combined with content switching.
The prefixing of a '/' then causes two slashes to be returned in
the response. So we now do as with the other redirects, don't
prepend a slash if it's alone.
(cherry picked from commit dcb75c4a83)
This commit is contained in:
parent
1df8a6a684
commit
cd2ae4f342
1 changed files with 5 additions and 2 deletions
|
|
@ -651,8 +651,11 @@ void perform_http_redirect(struct session *s, struct stream_interface *si)
|
|||
if (rdr.len + s->srv->rdr_len > sizeof(trash))
|
||||
return;
|
||||
|
||||
memcpy(rdr.str + rdr.len, s->srv->rdr_pfx, s->srv->rdr_len);
|
||||
rdr.len += s->srv->rdr_len;
|
||||
/* special prefix "/" means don't change URL */
|
||||
if (s->srv->rdr_len != 1 || *s->srv->rdr_pfx != '/') {
|
||||
memcpy(rdr.str + rdr.len, s->srv->rdr_pfx, s->srv->rdr_len);
|
||||
rdr.len += s->srv->rdr_len;
|
||||
}
|
||||
|
||||
/* 3: add the request URI */
|
||||
txn = &s->txn;
|
||||
|
|
|
|||
Loading…
Reference in a new issue