aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_server/mod_alias.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2015-01-27 17:43:46 +0100
committerIngela Anderton Andin <[email protected]>2015-01-30 10:57:32 +0100
commit5c7e03e0b34d73aa35f882ffb3e02176282274c4 (patch)
tree1ae31b56328785d05d432545c9d49414cc006d3c /lib/inets/src/http_server/mod_alias.erl
parent4eeeca1538afecc294e04c50c5f6a4551eced9ec (diff)
downloadotp-5c7e03e0b34d73aa35f882ffb3e02176282274c4.tar.gz
otp-5c7e03e0b34d73aa35f882ffb3e02176282274c4.tar.bz2
otp-5c7e03e0b34d73aa35f882ffb3e02176282274c4.zip
inets: httpd - mod_alias now handles https URIs
Diffstat (limited to 'lib/inets/src/http_server/mod_alias.erl')
-rw-r--r--lib/inets/src/http_server/mod_alias.erl14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/inets/src/http_server/mod_alias.erl b/lib/inets/src/http_server/mod_alias.erl
index 0b9fe4cfe0..5039cd56b5 100644
--- a/lib/inets/src/http_server/mod_alias.erl
+++ b/lib/inets/src/http_server/mod_alias.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -55,6 +55,7 @@ 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)),
@@ -70,8 +71,9 @@ do_alias(#mod{config_db = ConfigDB,
(LastChar =/= $/)) ->
?hdrt("directory and last-char is a /", []),
ServerName = which_server_name(ConfigDB),
- Port = port_string( which_port(ConfigDB) ),
- URL = "http://" ++ ServerName ++ Port ++ ReqURI ++ "/",
+ Port = port_string(which_port(ConfigDB)),
+ Protocol = get_protocol(SocketType),
+ URL = Protocol ++ ServerName ++ Port ++ ReqURI ++ "/",
ReasonPhrase = httpd_util:reason_phrase(301),
Message = httpd_util:message(301, URL, ConfigDB),
{proceed,
@@ -94,6 +96,12 @@ 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, []) ->