Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
1379-inets-Use-relative-redirects-in-mod_alias....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1379-inets-Use-relative-redirects-in-mod_alias.patch of Package erlang
From b813bc0b09b44d9b5ada70f153904c435c4b4aa1 Mon Sep 17 00:00:00 2001 From: Johannes Christ <jc@jchri.st> Date: Sat, 23 Sep 2023 15:37:20 +0200 Subject: [PATCH] inets: Use relative redirects in mod_alias Use a relative redirect with an absolute path to prevent whoever is running inets from having to configure the `ServerName` to match the network-reachable hostname of the server. Fixes #7617. --- lib/inets/src/http_server/mod_alias.erl | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/inets/src/http_server/mod_alias.erl b/lib/inets/src/http_server/mod_alias.erl index b310a7c909..f82fa877a0 100644 --- a/lib/inets/src/http_server/mod_alias.erl +++ b/lib/inets/src/http_server/mod_alias.erl @@ -54,7 +54,6 @@ do(#mod{data = Data} = Info) -> do_alias(#mod{config_db = ConfigDB, request_uri = ReqURI, - socket_type = SocketType, data = Data}) -> {ShortPath, Path, AfterPath} = real_name(ConfigDB, ReqURI, which_alias(ConfigDB)), @@ -63,12 +62,8 @@ do_alias(#mod{config_db = ConfigDB, case file:read_file_info(ShortPath) of {ok, FileInfo} when ((FileInfo#file_info.type =:= directory) andalso (LastChar =/= $/)) -> - ServerName = which_server_name(ConfigDB), - Port = port_string(which_port(ConfigDB)), - Protocol = get_protocol(SocketType), {ReqPath, ReqQuery} = httpd_util:split_path(ReqURI), - URL = Protocol ++ ServerName ++ Port ++ ReqPath ++ "/" ++ - ["?" ++ ReqQuery || [] /= ReqQuery], + URL = ReqPath ++ "/" ++ ["?" ++ ReqQuery || [] /= ReqQuery], ReasonPhrase = httpd_util:reason_phrase(301), Message = httpd_util:message(301, URL, ConfigDB), {proceed, @@ -86,17 +81,6 @@ do_alias(#mod{config_db = ConfigDB, {proceed, [{real_name, {Path, AfterPath}} | Data]} end. -port_string(80) -> - ""; -port_string(Port) -> - ":" ++ integer_to_list(Port). - -get_protocol(ip_comm) -> - "http://"; -get_protocol(_) -> - %% Should clean up to have only one ssl type essl vs ssl is not relevant any more - "https://". - %% real_name real_name(ConfigDB, RequestURI, []) -> @@ -282,12 +266,6 @@ is_directory_index_list(_) -> which_alias(ConfigDB) -> httpd_util:multi_lookup(ConfigDB, alias). -which_server_name(ConfigDB) -> - httpd_util:lookup(ConfigDB, server_name). - -which_port(ConfigDB) -> - httpd_util:lookup(ConfigDB, port, 80). - which_document_root(ConfigDB) -> Root = httpd_util:lookup(ConfigDB, document_root, ""), case string:tokens(Root, ":") of -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor