summaryrefslogtreecommitdiff
path: root/lib/inets/src
diff options
context:
space:
mode:
authorJakub Witczak <kuba@erlang.org>2023-02-17 13:57:35 +0100
committerJakub Witczak <kuba@erlang.org>2023-02-20 09:17:50 +0100
commit550d5733b95c088cc63a6db7521b3d1e284909b0 (patch)
tree19107faf69c7c92c486f1bb5eb9fd2bbb6cc9a55 /lib/inets/src
parent0863bd30aabd035c83158c78046c5ffda16127e1 (diff)
downloaderlang-550d5733b95c088cc63a6db7521b3d1e284909b0.tar.gz
inets: fix httpd and folder URI alias
- for URI pointing to a folder (missing trailing /) with a query component - insert '/' after patch component but before query - improve alias test
Diffstat (limited to 'lib/inets/src')
-rw-r--r--lib/inets/src/http_server/mod_alias.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/inets/src/http_server/mod_alias.erl b/lib/inets/src/http_server/mod_alias.erl
index 94607e705a..c2365484a6 100644
--- a/lib/inets/src/http_server/mod_alias.erl
+++ b/lib/inets/src/http_server/mod_alias.erl
@@ -66,7 +66,9 @@ do_alias(#mod{config_db = ConfigDB,
ServerName = which_server_name(ConfigDB),
Port = port_string(which_port(ConfigDB)),
Protocol = get_protocol(SocketType),
- URL = Protocol ++ ServerName ++ Port ++ ReqURI ++ "/",
+ {ReqPath, ReqQuery} = httpd_util:split_path(ReqURI),
+ URL = Protocol ++ ServerName ++ Port ++ ReqPath ++ "/" ++
+ ["?" ++ ReqQuery || [] /= ReqQuery],
ReasonPhrase = httpd_util:reason_phrase(301),
Message = httpd_util:message(301, URL, ConfigDB),
{proceed,