<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">
<erlref>
<header>
<copyright>
<year>1997</year><year>2009</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
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
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
</legalnotice>
<title>mod_alias</title>
<prepared>Joakim Grebenö</prepared>
<docno></docno>
<date>1997-10-14</date>
<rev>2.2</rev>
<file>mod_alias.sgml</file>
</header>
<module>mod_alias</module>
<modulesummary>URL aliasing.</modulesummary>
<description>
<p>Erlang Webserver Server internal API for handling of things
such as interaction data exported by the mod_alias module.</p>
</description>
<funcs>
<func>
<name>default_index(ConfigDB, Path) -> NewPath</name>
<fsummary>Return a new path with the default resource or file appended.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>Path = NewPath = string()</v>
</type>
<desc>
<marker id="default_index"></marker>
<p>If <c>Path</c> is a directory, <c>default_index/2</c>, it starts
searching for resources or files that are specified in the config
directive DirectoryIndex.
If an appropriate resource or file is found, it is appended to
the end of <c>Path</c> and then returned. <c>Path</c> is
returned unaltered, if no appropriate
file is found, or if <c>Path</c> is not a directory.
<c>config_db()</c> is the server config file in ETS table format
as described in
<seealso marker="http_server">Inets Users Guide.</seealso>.</p>
</desc>
</func>
<func>
<name>path(PathData, ConfigDB, RequestURI) -> Path</name>
<fsummary>Return the actual file path to a URL.</fsummary>
<type>
<v>PathData = interaction_data()</v>
<v>ConfigDB = config_db()</v>
<v>RequestURI = Path = string()</v>
</type>
<desc>
<marker id="path"></marker>
<p><c>path/3</c> returns the actual file <c>Path</c> in the
<c>RequestURI</c> (See RFC 1945). If the interaction data
<c>{real_name,{Path,AfterPath}}</c> has been exported by
mod_alias;
<c>Path</c> is returned. If no interaction data has been
exported, ServerRoot is used to
generate a file <c>Path</c>. <c>config_db()</c> and
<c>interaction_data()</c> are as defined in <seealso marker="http_server">Inets Users Guide</seealso>.</p>
</desc>
</func>
<func>
<name>real_name(ConfigDB, RequestURI, Aliases) -> Ret</name>
<fsummary>Expand a request uri using Alias config directives.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>RequestURI = string()</v>
<v>Aliases = [{FakeName,RealName}]</v>
<v>Ret = {ShortPath,Path,AfterPath}</v>
<v>ShortPath = Path = AfterPath = string()</v>
</type>
<desc>
<marker id="real_name"></marker>
<p><c>real_name/3</c> traverses <c>Aliases</c>, typically
extracted from <c>ConfigDB</c>, and matches each
<c>FakeName</c> with <c>RequestURI</c>. If a match is found
<c>FakeName</c> is replaced with <c>RealName</c> in the
match. The resulting path is split into two parts, that
is <c>ShortPath</c> and <c>AfterPath</c> as defined in <seealso marker="httpd_util#split_path">httpd_util:split_path/1</seealso>.
<c>Path</c> is generated from <c>ShortPath</c>, that is
the result from <seealso marker="#default_index">default_index/2</seealso> with
<c>ShortPath</c> as an argument.
<c>config_db()</c> is the server config file in ETS table
format as described in <seealso marker="http_server">Inets User Guide.</seealso>. </p>
</desc>
</func>
<func>
<name>real_script_name(ConfigDB,RequestURI,ScriptAliases) -> Ret</name>
<fsummary>Expand a request uri using ScriptAlias config directives.</fsummary>
<type>
<v>ConfigDB = config_db()</v>
<v>RequestURI = string()</v>
<v>ScriptAliases = [{FakeName,RealName}]</v>
<v>Ret = {ShortPath,AfterPath} | not_a_script</v>
<v>ShortPath = AfterPath = string()</v>
</type>
<desc>
<marker id="real_script_name"></marker>
<p><c>real_name/3</c> traverses <c>ScriptAliases</c>,
typically extracted from <c>ConfigDB</c>, and matches each
<c>FakeName</c> with <c>RequestURI</c>. If a match is found
<c>FakeName</c> is replaced with <c>RealName</c> in the
match. If the resulting match is not an executable script
<c>not_a_script</c> is returned. If it is a script the
resulting script path is in two parts, that is
<c>ShortPath</c> and <c>AfterPath</c> as defined in <seealso marker="httpd_util#split_script_path">httpd_util:split_script_path/1</seealso>.
<c>config_db()</c> is the server config file in ETS table
format as described in <seealso marker="http_server">Inets Users Guide.</seealso>.</p>
</desc>
</func>
</funcs>
</erlref>