aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-02-06 14:49:42 +0100
committerMicael Karlberg <[email protected]>2012-02-06 14:49:42 +0100
commitdcf35c1ef914f7473bb64fa9175af2cf42744885 (patch)
tree04183491c784b1d9ff0e2fcdbf06f6bd2d22755e /lib
parent2d97f0e5f13bf22d92dbc6df18787581eb462c41 (diff)
parentf555a1b1ed4461c33a99737136daf2793479425e (diff)
downloadotp-dcf35c1ef914f7473bb64fa9175af2cf42744885.tar.gz
otp-dcf35c1ef914f7473bb64fa9175af2cf42744885.tar.bz2
otp-dcf35c1ef914f7473bb64fa9175af2cf42744885.zip
Merge branch 'bmk/inets/httpd/configurable_server_tokens/OTP-9805' into bmk/inets/inets59_integration
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/doc/src/httpd.xml545
-rw-r--r--lib/inets/doc/src/notes.xml73
-rw-r--r--lib/inets/src/http_server/Makefile2
-rw-r--r--lib/inets/src/http_server/httpd_conf.erl106
-rw-r--r--lib/inets/src/http_server/httpd_response.erl27
-rw-r--r--lib/inets/src/http_server/httpd_script_env.erl57
-rw-r--r--lib/inets/src/inets_app/inets.mk2
-rw-r--r--lib/inets/vsn.mk2
8 files changed, 564 insertions, 250 deletions
diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml
index f88099a82e..7e21229fcf 100644
--- a/lib/inets/doc/src/httpd.xml
+++ b/lib/inets/doc/src/httpd.xml
@@ -55,14 +55,14 @@
<section>
<title>ERLANG HTTP SERVER SERVICE START/STOP </title>
<p>A web server can be configured to start when starting the inets
- application or started dynamically in runtime by calling the
- Inets application API <c>inets:start(httpd, ServiceConfig)</c>, or
- <c>inets:start(httpd, ServiceConfig, How)</c>,
- see <seealso marker="inets">inets(3)</seealso> Below follows a
- description of the available configuration options, also called
- properties.</p>
-
- <marker id="file_prop"></marker>
+ application or started dynamically in runtime by calling the
+ Inets application API <c>inets:start(httpd, ServiceConfig)</c>, or
+ <c>inets:start(httpd, ServiceConfig, How)</c>,
+ see <seealso marker="inets">inets(3)</seealso> Below follows a
+ description of the available configuration options, also called
+ properties.</p>
+
+ <marker id="props_file"></marker>
<p><em>File properties</em></p>
<p>When the web server is started
@@ -76,21 +76,25 @@
list.</p>
<taglist>
+ <marker id="prop_proplist_file"></marker>
<tag>{proplist_file, path()}</tag>
<item>
- If this property is defined inets will expect to find
- all other properties defined in this file. Note that the
- file must include all properties listed under mandatory
- properties. </item>
- <tag>{file, path()}</tag>
+ <p>If this property is defined inets will expect to find
+ all other properties defined in this file. Note that the
+ file must include all properties listed under mandatory
+ properties. </p>
+ </item>
- <item> If this property is defined
- inets will expect to find all other properties defined in this
- file, that uses Apache like syntax. Note that the file must
- include all properties listed under mandatory properties. The
- Apache like syntax is the property, written as one word where
- each new word begins with a capital, followed by a white-space
- followed by the value followed by a new line. Ex:
+ <marker id="prop_file"></marker>
+ <tag>{file, path()}</tag>
+ <item>
+ <p>If this property is defined inets will expect to find all
+ other properties defined in this file, that uses Apache like
+ syntax. Note that the file must include all properties listed
+ under mandatory properties. The Apache like syntax is the property,
+ written as one word where each new word begins with a capital,
+ followed by a white-space followed by the value followed by a
+ new line. Ex: </p>
<code>
{server_root, "/urs/local/www"} -> ServerRoot /usr/local/www
@@ -114,40 +118,51 @@
<p>The properties proplist_file and file are mutually exclusive.</p>
</note>
- <marker id="mand_prop"></marker>
+ <marker id="props_mand"></marker>
<p><em>Mandatory properties</em></p>
<taglist>
+ <marker id="prop_port"></marker>
<tag>{port, integer()} </tag>
<item>
- The port that the HTTP server shall listen on.
- If zero is specified as port, an arbitrary available port
- will be picked and you can use the httpd:info/2 function to find
- out which port was picked. </item>
+ <p>The port that the HTTP server shall listen on.
+ If zero is specified as port, an arbitrary available port
+ will be picked and you can use the httpd:info/2 function to find
+ out which port was picked. </p>
+ </item>
+
+ <marker id="prop_server_name"></marker>
<tag>{server_name, string()} </tag>
<item>
- The name of your server, normally a fully qualified domain
- name.
+ <p>The name of your server, normally a fully qualified domain name. </p>
</item>
+
+ <marker id="prop_server_root"></marker>
<tag>{server_root, path()} </tag>
<item>
- Defines the servers home directory where log files etc can
+ <p>Defines the servers home directory where log files etc can
be stored. Relative paths specified in other properties refer
- to this directory.</item>
+ to this directory. </p>
+ </item>
+
+ <marker id="prop_doc_root"></marker>
<tag>{document_root, path()}</tag>
<item>
Defines the top directory for the documents that
- are available on the HTTP server.</item>
+ are available on the HTTP server.
+ </item>
</taglist>
- <marker id="comm_prop"></marker>
+ <marker id="props_comm"></marker>
<p><em>Communication properties</em> </p>
<taglist>
+ <marker id="prop_bind_address"></marker>
<tag>{bind_address, ip_address() | hostname() | any} </tag>
<item>
- Defaults to <c>any</c>. Note that <c>any</c> is denoted <em>*</em>
- in the apache like configuration file.
+ <p>Defaults to <c>any</c>. Note that <c>any</c> is denoted <em>*</em>
+ in the apache like configuration file. </p>
</item>
+ <marker id="prop_socket_type"></marker>
<tag>{socket_type, ip_comm | ssl | essl}</tag>
<item>
<p>When using ssl, there are currently only one alternative.
@@ -156,6 +171,7 @@
<p>Defaults to <c>ip_comm</c>. </p>
</item>
+ <marker id="prop_ipfamily"></marker>
<tag>{ipfamily, inet | inet6 | inet6fb4}</tag>
<item>
<p>Defaults to <c>inet6fb4. </c> </p>
@@ -165,74 +181,93 @@
</taglist>
+ <marker id="props_api_modules"></marker>
<p><em>Erlang Web server API modules</em> </p>
<taglist>
+ <marker id="prop_modules"></marker>
<tag>{modules, [atom()]} </tag>
<item>
- Defines which modules the HTTP server will use to handle
+ <p>Defines which modules the HTTP server will use to handle
requests. Defaults to: <c>[mod_alias, mod_auth, mod_esi,
mod_actions, mod_cgi, mod_dir, mod_get, mod_head, mod_log,
mod_disk_log] </c>
Note that some mod-modules are dependent on
others, so the order can not be entirely arbitrary. See the
<seealso marker="http_server"> Inets Web server Modules in the
- Users guide</seealso> for more information.
+ Users guide</seealso> for more information. </p>
</item>
- </taglist>
+ </taglist>
- <marker id="limit_prop"></marker>
+ <marker id="props_limit"></marker>
<p><em>Limit properties</em> </p>
<taglist>
+ <marker id="prop_disable_chunked_encoding"></marker>
<tag>{disable_chunked_transfer_encoding_send, boolean()}</tag>
<item>
- This property allows you to disable chunked
+ <p>This property allows you to disable chunked
transfer-encoding when sending a response to a HTTP/1.1
- client, by default this is false.</item>
+ client, by default this is false. </p>
+ </item>
+ <marker id="prop_keep_alive"></marker>
<tag>{keep_alive, boolean()}</tag>
<item>
- Instructs the server whether or not to use persistent
+ <p>Instructs the server whether or not to use persistent
connections when the client claims to be HTTP/1.1
- compliant, default is true.</item>
+ compliant, default is true. </p>
+ </item>
+ <marker id="prop_keep_alive_timeout"></marker>
<tag>{keep_alive_timeout, integer()}</tag>
<item>
- The number of seconds the server will wait for a
+ <p>The number of seconds the server will wait for a
subsequent request from the client before closing the
- connection. Default is 150.</item>
+ connection. Default is 150. </p>
+ </item>
+ <marker id="prop_max_body_size"></marker>
<tag>{max_body_size, integer()}</tag>
<item>
- Limits the size of the message body of HTTP request.
- By the default there is no limit.</item>
+ <p>Limits the size of the message body of HTTP request.
+ By the default there is no limit. </p>
+ </item>
+ <marker id="prop_max_clients"></marker>
<tag>{max_clients, integer()}</tag>
<item>
- Limits the number of simultaneous requests that can be
- supported. Defaults to 150. </item>
+ <p>Limits the number of simultaneous requests that can be
+ supported. Defaults to 150. </p>
+ </item>
+ <marker id="prop_max_header_size"></marker>
<tag>{max_header_size, integer()}</tag>
<item>
- Limits the size of the message header of HTTP request.
- Defaults to 10240.
+ <p>Limits the size of the message header of HTTP request.
+ Defaults to 10240. </p>
</item>
+ <marker id="prop_max_uri"></marker>
<tag>{max_uri, integer()}</tag>
<item>
- Limits the size of the HTTP request URI. By
- default there is no limit.</item>
+ <p>Limits the size of the HTTP request URI. By
+ default there is no limit. </p>
+ </item>
+ <marker id="prop_max_keep_alive_req"></marker>
<tag>{max_keep_alive_requests, integer()}</tag>
- <item> The number of request that a client can do on one
+ <item>
+ <p>The number of request that a client can do on one
connection. When the server has responded to the number of
requests defined by max_keep_alive_requests the server close the
connection. The server will close it even if there are queued
- request. Defaults to no limit.</item>
+ request. Defaults to no limit. </p>
+ </item>
</taglist>
- <marker id="admin_prop"></marker>
+ <marker id="props_admin"></marker>
<p><em>Administrative properties</em></p>
<taglist>
+ <marker id="prop_mime_types"></marker>
<tag>{mime_types, [{MimeType, Extension}] | path()}</tag>
<item>
<p>Where MimeType = string() and Extension = string().
@@ -250,19 +285,43 @@ text/plain asc txt
<p>Defaults to [{"html","text/html"},{"htm","text/html"}]</p>
</item>
+ <marker id="prop_mime_type"></marker>
<tag>{mime_type, string()}</tag>
-
<item>
- When the server is asked to provide a document type which
+ <p>When the server is asked to provide a document type which
cannot be determined by the MIME Type Settings, the server will
- use this default type. </item>
+ use this default type. </p>
+ </item>
+ <marker id="prop_server_admin"></marker>
<tag>{server_admin, string()}</tag>
<item>
- ServerAdmin defines the email-address of the server
+ <p>ServerAdmin defines the email-address of the server
administrator, to be included in any error messages returned by
- the server.</item>
+ the server. </p>
+ </item>
+ <marker id="prop_server_tokens"></marker>
+ <tag>{server_tokens, prod|major|minor|minimal|os|full|{private, string()}}</tag>
+ <item>
+ <p>ServerTokens defines how the value of the server header
+ should look. </p>
+ <p>Example: Assuming the version of inets is 5.8.1,
+ here is what the server header string could look like for
+ the different values of server-tokens: </p>
+ <pre>
+prod "inets"
+major "inets/5"
+minor "inets/5.8"
+minimal "inets/5.8.1"
+os "inets/5.8.1 (unix)"
+full "inets/5.8.1 (unix/linux) OTP/R15B"
+{private, "foo/bar"} "foo/bar"
+ </pre>
+ <p>By default, the value is as before, which is <c>minimal</c>. </p>
+ </item>
+
+ <marker id="prop_log_format"></marker>
<tag>{log_format, common | combined}</tag>
<item>
<p>Defines if access logs should be written according to the common
@@ -307,8 +366,9 @@ bytes
<p>This affects the access logs written by mod_log and mod_disk_log.
</p>
- </item>
-
+ </item>
+
+ <marker id="prop_elog_format"></marker>
<tag>{error_log_format, pretty | compact}</tag>
<item>
<p>Defaults to pretty. If the error log is meant to be read
@@ -330,63 +390,77 @@ bytes
</taglist>
- <marker id="ssl_prop"></marker>
+ <marker id="props_ssl"></marker>
<p><em>ssl properties</em></p>
<taglist>
+ <marker id="prop_ssl_ca_cert_file"></marker>
<tag>{ssl_ca_certificate_file, path()}</tag>
<item>
- Used as cacertfile option in ssl:listen/2 see
- <seealso marker="ssl:ssl">ssl(3)</seealso> </item>
+ <p>Used as cacertfile option in ssl:listen/2 see
+ <seealso marker="ssl:ssl">ssl(3)</seealso>. </p>
+ </item>
+ <marker id="prop_ssl_cert_file"></marker>
<tag>{ssl_certificate_file, path()}</tag>
<item>
- Used as certfile option in ssl:listen/2 see
- <seealso marker="ssl:ssl">ssl(3)</seealso>
+ <p>Used as certfile option in ssl:listen/2 see
+ <seealso marker="ssl:ssl">ssl(3)</seealso>. </p>
</item>
+ <marker id="prop_ssl_ciphers"></marker>
<tag>{ssl_ciphers, list()}</tag>
<item>
- Used as ciphers option in ssl:listen/2 see
- <seealso marker="ssl:ssl">ssl(3)</seealso>
+ <p>Used as ciphers option in ssl:listen/2 see
+ <seealso marker="ssl:ssl">ssl(3)</seealso>. </p>
</item>
+ <marker id="prop_ssl_verify_client"></marker>
<tag>{ssl_verify_client, integer()}</tag>
<item>
- Used as verify option in ssl:listen/2 see
- <seealso marker="ssl:ssl">ssl(3)</seealso> </item>
+ <p>Used as verify option in ssl:listen/2 see
+ <seealso marker="ssl:ssl">ssl(3)</seealso>. </p>
+ </item>
+ <marker id="prop_ssl_verify_depth"></marker>
<tag>{ssl_verify_depth, integer()}</tag>
<item>
- Used as depth option in ssl:listen/2 see
- <seealso marker="ssl:ssl">ssl(3)</seealso> </item>
+ <p>Used as depth option in ssl:listen/2 see
+ <seealso marker="ssl:ssl">ssl(3)</seealso>. </p>
+ </item>
+ <marker id="prop_ssl_passwd_callback_funct"></marker>
<tag>{ssl_password_callback_function, atom()}</tag>
<item>
- Used together with ssl_password_callback_module
+ <p>Used together with ssl_password_callback_module
to retrieve a value to use as password option to ssl:listen/2
- see <seealso marker="ssl:ssl">ssl(3)</seealso>
+ see <seealso marker="ssl:ssl">ssl(3)</seealso>. </p>
</item>
+ <marker id="prop_ssl_passwd_callback_args"></marker>
<tag>{ssl_password_callback_arguments, list()}</tag>
<item>
- Used together with ssl_password_callback_function to supply a
+ <p>Used together with ssl_password_callback_function to supply a
list of arguments to the callback function. If not specified
- the callback function will be assumed to have arity 0. </item>
+ the callback function will be assumed to have arity 0. </p>
+ </item>
+ <marker id="prop_ssl_passwd_callback_mod"></marker>
<tag>{ssl_password_callback_module, atom()}</tag>
<item>
- Used together with ssl_password_callback_function
+ <p>Used together with ssl_password_callback_function
to retrieve a value to use as password option to ssl:listen/2
- see <seealso marker="ssl:ssl">ssl(3)</seealso></item>
+ see <seealso marker="ssl:ssl">ssl(3)</seealso>. </p>
+ </item>
</taglist>
- <marker id="alias_prop"></marker>
+ <marker id="props_alias"></marker>
<p><em>URL aliasing properties - requires mod_alias</em></p>
<taglist>
+ <marker id="prop_alias"></marker>
<tag>{alias, {Alias, RealName}}</tag>
-
- <item> Where Alias = string() and RealName = string().
+ <item>
+ <p>Where Alias = string() and RealName = string().
The Alias property allows documents to be stored in the local file
system instead of the document_root location. URLs with a path that
begins with url-path is mapped to local files that begins with
@@ -395,11 +469,13 @@ bytes
<code>{alias, {"/image", "/ftp/pub/image"}</code>
and an access to http://your.server.org/image/foo.gif would refer to
- the file /ftp/pub/image/foo.gif.</item>
+ the file /ftp/pub/image/foo.gif. </p>
+ </item>
- <tag>{re_write, {Re, Replacement}}</tag>
-
- <item> Where Re = string() and Replacement = string().
+ <marker id="prop_re_write"></marker>
+ <tag>{re_write, {Re, Replacement}}</tag>
+ <item>
+ <p>Where Re = string() and Replacement = string().
The ReWrite property allows documents to be stored in the local file
system instead of the document_root location. URLs are rewritten
by re:replace/3 to produce a path in the local filesystem.
@@ -419,13 +495,13 @@ bytes
Beware of trailing space in Replacement that will be used.
If you must have a space in Re use e.g the character encoding
- <code>\040</code> see <seealso marker="stdlib:re">re(3)</seealso>.
+ <code>\040</code> see <seealso marker="stdlib:re">re(3)</seealso>. </p>
</item>
- <tag>{directory_index, [string()]}</tag>
-
+ <marker id="prop_dir_idx"></marker>
+ <tag>{directory_index, [string()]}</tag>
<item>
- DirectoryIndex specifies a list of resources to look for
+ <p>DirectoryIndex specifies a list of resources to look for
if a client requests a directory using a / at the end of the
directory name. file depicts the name of a file in the
directory. Several files may be given, in which case the server
@@ -436,70 +512,79 @@ bytes
and access to http://your.server.org/docs/ would return
http://your.server.org/docs/index.html or
http://your.server.org/docs/welcome.html if index.html do not
- exist.
+ exist. </p>
</item>
</taglist>
- <marker id="cgi_prop"></marker>
+ <marker id="props_cgi"></marker>
<p><em>CGI properties - requires mod_cgi</em></p>
<taglist>
+ <marker id="prop_script_alias"></marker>
<tag>{script_alias, {Alias, RealName}}</tag>
- <item> Where Alias = string() and RealName = string().
+ <item>
+ <p>Where Alias = string() and RealName = string().
Has the same behavior as the Alias property, except that
it also marks the target directory as containing CGI
scripts. URLs with a path beginning with url-path are mapped to
scripts beginning with directory-filename, for example:
- <code> {script_alias, {"/cgi-bin/", "/web/cgi-bin/"}</code>
+ <code>{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}</code>
and an access to http://your.server.org/cgi-bin/foo would cause
- the server to run the script /web/cgi-bin/foo.
+ the server to run the script /web/cgi-bin/foo. </p>
</item>
+ <marker id="prop_script_re_write"></marker>
<tag>{script_re_write, {Re, Replacement}}</tag>
- <item> Where Re = string() and Replacement = string().
+ <item>
+ <p>Where Re = string() and Replacement = string().
Has the same behavior as the ReWrite property, except that
it also marks the target directory as containing CGI
scripts. URLs with a path beginning with url-path are mapped to
scripts beginning with directory-filename, for example:
- <code> {script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}</code>
+ <code>{script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}</code>
and an access to http://your.server.org/cgi-bin/17/foo would cause
- the server to run the script /web/17/cgi-bin/foo.
+ the server to run the script /web/17/cgi-bin/foo. </p>
</item>
+ <marker id="prop_script_nocache"></marker>
<tag>{script_nocache, boolean()}</tag>
-
<item>
- If ScriptNoCache is set to true the HTTP server will by
+ <p>If ScriptNoCache is set to true the HTTP server will by
default add the header fields necessary to prevent proxies from
caching the page. Generally this is something you want. Defaults
- to false.</item>
+ to false. </p>
+ </item>
+ <marker id="prop_script_timeout"></marker>
<tag>{script_timeout, integer()}</tag>
-
<item>
- The time in seconds the web server will wait between each
+ <p>The time in seconds the web server will wait between each
chunk of data from the script. If the CGI-script not delivers
any data before the timeout the connection to the client will be
- closed. Defaults to 15. </item>
+ closed. Defaults to 15. </p>
+ </item>
+ <marker id="prop_action"></marker>
<tag>{action, {MimeType, CgiScript}} - requires mod_action</tag>
-
- <item>Where MimeType = string() and CgiScript = string().
+ <item>
+ <p>Where MimeType = string() and CgiScript = string().
Action adds an action, which will activate a cgi-script
whenever a file of a certain mime-type is requested. It
propagates the URL and file path of the requested document using
the standard CGI PATH_INFO and PATH_TRANSLATED environment
variables.
- <code> {action, {"text/plain", "/cgi-bin/log_and_deliver_text"}
- </code>
+
+ <code>{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}</code>
+ </p>
</item>
+ <marker id="prop_script"></marker>
<tag>{script, {Method, CgiScript}} - requires mod_action</tag>
-
- <item>Where Method = string() and CgiScript = string().
+ <item>
+ <p>Where Method = string() and CgiScript = string().
Script adds an action, which will activate a cgi-script
whenever a file is requested using a certain HTTP method. The
method is either GET or POST as defined in RFC 1945. It
@@ -507,18 +592,19 @@ bytes
the standard CGI PATH_INFO and PATH_TRANSLATED environment
variables.
- <code> {script, {"PUT", "/cgi-bin/put"}
- </code>
+ <code>{script, {"PUT", "/cgi-bin/put"}</code>
+ </p>
</item>
</taglist>
- <marker id="esi_prop"></marker>
+ <marker id="props_esi"></marker>
<p><em>ESI properties - requires mod_esi</em></p>
<taglist>
- <tag>{erl_script_alias, {URLPath, [AllowedModule]}}</tag>
-
- <item>Where URLPath = string() and AllowedModule = atom().
+ <marker id="prop_esi_alias"></marker>
+ <tag>{erl_script_alias, {URLPath, [AllowedModule]}}</tag>
+ <item>
+ <p>Where URLPath = string() and AllowedModule = atom().
erl_script_alias marks all URLs matching url-path as erl
scheme scripts. A matching URL is mapped into a specific module
and function. For example:
@@ -531,140 +617,151 @@ bytes
would refer to httpd_example:yahoo/3 or, if that did not exist,
httpd_example:yahoo/2 and
http://your.server.org/cgi-bin/example/other:yahoo would
- not be allowed to execute.
+ not be allowed to execute. </p>
</item>
+ <marker id="prop_esi_nocache"></marker>
<tag>{erl_script_nocache, boolean()}</tag>
-
<item>
- If erl_script_nocache is set to true the server will add
+ <p>If erl_script_nocache is set to true the server will add
http header fields that prevents proxies from caching the
page. This is generally a good idea for dynamic content, since
- the content often vary between each request. Defaults to false.
+ the content often vary between each request.
+ Defaults to false. </p>
</item>
+ <marker id="prop_esi_timeout"></marker>
<tag>{erl_script_timeout, integer()}</tag>
-
<item>
- If erl_script_timeout sets the time in seconds the server will
+ <p>If erl_script_timeout sets the time in seconds the server will
wait between each chunk of data to be delivered through
mod_esi:deliver/2. Defaults to 15. This is only relevant
- for scripts that uses the erl scheme.
+ for scripts that uses the erl scheme. </p>
</item>
+ <marker id="prop_esi_timeout"></marker>
<tag>{eval_script_alias, {URLPath, [AllowedModule]}}</tag>
-
- <item>Where URLPath = string() and AllowedModule = atom().
+ <item>
+ <p>Where URLPath = string() and AllowedModule = atom().
Same as erl_script_alias but for scripts
- using the eval scheme. Note that this is only supported
- for backwards compatibility. The eval scheme is deprecated.</item>
+ using the eval scheme. Note that this is only supported
+ for backwards compatibility. The eval scheme is deprecated. </p>
+ </item>
</taglist>
- <marker id="log_prop"></marker>
+ <marker id="props_log"></marker>
<p><em>Log properties - requires mod_log</em></p>
<taglist>
+ <marker id="prop_elog"></marker>
<tag>{error_log, path()}</tag>
-
<item>
- Defines the filename of the error log file to be used to log
+ <p>Defines the filename of the error log file to be used to log
server errors. If the filename does not begin with a slash (/)
- it is assumed to be relative to the server_root</item>
+ it is assumed to be relative to the server_root. </p>
+ </item>
+ <marker id="prop_slog"></marker>
<tag>{security_log, path()}</tag>
-
<item>
- Defines the filename of the access log file to be used to
- log security events. If the filename does not begin with a slash
- (/) it is assumed to be relative to the server_root.
+ <p>Defines the filename of the access log file to be used to
+ log security events. If the filename does not begin with a slash
+ (/) it is assumed to be relative to the server_root. </p>
</item>
+ <marker id="prop_tlog"></marker>
<tag>{transfer_log, path()}</tag>
-
<item>
- Defines the filename of the access log file to be used to
+ <p>Defines the filename of the access log file to be used to
log incoming requests. If the filename does not begin with a
- slash (/) it is assumed to be relative to the server_root.
+ slash (/) it is assumed to be relative to the server_root. </p>
</item>
</taglist>
- <marker id="dlog_prop"></marker>
+ <marker id="props_dlog"></marker>
<p><em>Disk Log properties - requires mod_disk_log</em></p>
<taglist>
+ <marker id="prop_dlog_format"></marker>
<tag>{disk_log_format, internal | external}</tag>
-
<item>
- Defines the file-format of the log files see disk_log for
+ <p>Defines the file-format of the log files see disk_log for
more information. If the internal file-format is used, the
logfile will be repaired after a crash. When a log file is
repaired data might get lost. When the external file-format is
used httpd will not start if the log file is broken. Defaults to
- external.
+ external. </p>
</item>
+ <marker id="prop_edlog"></marker>
<tag>{error_disk_log, internal | external}</tag>
-
<item>
- Defines the filename of the (disk_log(3)) error log file
+ <p>Defines the filename of the (disk_log(3)) error log file
to be used to log server errors. If the filename does not begin
- with a slash (/) it is assumed to be relative to the server_root.
+ with a slash (/) it is assumed to be relative to the server_root. </p>
</item>
+ <marker id="prop_edlog_size"></marker>
<tag>{error_disk_log_size, {MaxBytes, MaxFiles}}</tag>
-
- <item>Where MaxBytes = integer() and MaxFiles = integer().
+ <item>
+ <p>Where MaxBytes = integer() and MaxFiles = integer().
Defines the properties of the (disk_log(3)) error log
file. The disk_log(3) error log file is of type wrap log and
max-bytes will be written to each file and max-files will be
- used before the first file is truncated and reused. </item>
+ used before the first file is truncated and reused. </p>
+ </item>
+ <marker id="prop_sdlog"></marker>
<tag>{security_disk_log, path()}</tag>
-
<item>
- Defines the filename of the (disk_log(3)) access log file
+ <p>Defines the filename of the (disk_log(3)) access log file
which logs incoming security events i.e authenticated
requests. If the filename does not begin with a slash (/) it
- is assumed to be relative to the server_root.
+ is assumed to be relative to the server_root. </p>
</item>
+ <marker id="prop_sdlog_size"></marker>
<tag>{security_disk_log_size, {MaxBytes, MaxFiles}}</tag>
-
- <item>Where MaxBytes = integer() and MaxFiles = integer().
+ <item>
+ <p>Where MaxBytes = integer() and MaxFiles = integer().
Defines the properties of the disk_log(3) access log
file. The disk_log(3) access log file is of type wrap log and
max-bytes will be written to each file and max-files will be
- used before the first file is truncated and reused.</item>
+ used before the first file is truncated and reused. </p>
+ </item>
- <tag>{transfer_disk_log, path()}</tag>
-
+ <marker id="prop_tdlog"></marker>
+ <tag>{transfer_disk_log, path()}</tag>
<item>
- Defines the filename of the (disk_log(3)) access log file
+ <p>Defines the filename of the (disk_log(3)) access log file
which logs incoming requests. If the filename does not begin
with a slash (/) it is assumed to be relative to the
- server_root.
+ server_root. </p>
</item>
+ <marker id="prop_tdlog_size"></marker>
<tag>{transfer_disk_log_size, {MaxBytes, MaxFiles}}</tag>
-
- <item>Where MaxBytes = integer() and MaxFiles = integer().
+ <item>
+ <p>Where MaxBytes = integer() and MaxFiles = integer().
Defines the properties of the disk_log(3) access log
file. The disk_log(3) access log file is of type wrap log and
max-bytes will be written to each file and max-files will be
- used before the first file is truncated and reused.</item>
+ used before the first file is truncated and reused. </p>
+ </item>
</taglist>
- <marker id="auth_prop"></marker>
+ <marker id="props_auth"></marker>
<p><em>Authentication properties - requires mod_auth</em></p>
+ <marker id="prop_dri"></marker>
<p><em>{directory, {path(), [{property(), term()}]}}</em></p>
- <marker id="dir_prop"></marker>
+ <marker id="props_dir"></marker>
<p>Here follows the valid properties for directories </p>
<taglist>
+ <marker id="prop_allow_from"></marker>
<tag>{allow_from, all | [RegxpHostString]}</tag>
-
<item>
- Defines a set of hosts which should be granted access to a
+ <p>Defines a set of hosts which should be granted access to a
given directory.
For example:
@@ -672,34 +769,36 @@ bytes
<code>{allow_from, ["123.34.56.11", "150.100.23"] </code>
The host 123.34.56.11 and all machines on the 150.100.23
- subnet are allowed access.</item>
+ subnet are allowed access. </p>
+ </item>
+ <marker id="prop_deny_from"></marker>
<tag>{deny_from, all | [RegxpHostString]}</tag>
-
<item>
- Defines a set of hosts
+ <p>Defines a set of hosts
which should be denied access to a given directory.
For example:
<code>{deny_from, ["123.34.56.11", "150.100.23"] </code>
The host 123.34.56.11 and all machines on the 150.100.23
- subnet are not allowed access.</item>
+ subnet are not allowed access. </p>
+ </item>
+ <marker id="prop_auth_type"></marker>
<tag>{auth_type, plain | dets | mnesia}</tag>
-
<item>
- Sets the type of authentication database that is used for the
+ <p>Sets the type of authentication database that is used for the
directory.The key difference between the different methods is
that dynamic data can be saved when Mnesia and Dets is used.
This property is called AuthDbType in the Apache like
- configuration files.
+ configuration files. </p>
</item>
+ <marker id="prop_auth_user_file"></marker>
<tag>{auth_user_file, path()}</tag>
-
<item>
- Sets the name of a file which contains the list of users and
+ <p>Sets the name of a file which contains the list of users and
passwords for user authentication. filename can be either
absolute or relative to the <c>server_root</c>. If using the
plain storage method, this file is a plain text file, where
@@ -717,12 +816,13 @@ bytes
storage method. For security reasons, make sure that the
<c>auth_user_file</c> is stored outside the document tree of the Web
server. If it is placed in the directory which it protects,
- clients will be able to download it.
+ clients will be able to download it. </p>
</item>
+ <marker id="prop_auth_group_file"></marker>
<tag>{auth_group_file, path()}</tag>
-
- <item> Sets the name of a file which contains the list of user
+ <item>
+ <p>Sets the name of a file which contains the list of user
groups for user authentication. Filename can be either
absolute or relative to the <c>server_root</c>. If you use the plain
storage method, the group file is a plain text file, where
@@ -738,93 +838,109 @@ bytes
For security reasons, make sure that the <c>auth_group_file</c> is
stored outside the document tree of the Web server. If it is
placed in the directory which it protects, clients will be
- able to download it.</item>
+ able to download it. </p>
+ </item>
+ <marker id="prop_auth_name"></marker>
<tag>{auth_name, string()}</tag>
-
<item>
- Sets the name of the authorization realm (auth-domain) for
+ <p>Sets the name of the authorization realm (auth-domain) for
a directory. This string informs the client about which user
- name and password to use. </item>
+ name and password to use. </p>
+ </item>
+ <marker id="prop_auth_access_passwd"></marker>
<tag>{auth_access_password, string()}</tag>
-
- <item> If set to other than "NoPassword" the password is required
+ <item>
+ <p>If set to other than "NoPassword" the password is required
for all API calls. If the password is set to "DummyPassword" the
password must be changed before any other API calls. To secure
the authenticating data the password must be changed after the
web server is started since it otherwise is written in clear
- text in the configuration file.</item>
+ text in the configuration file. </p>
+ </item>
+ <marker id="prop_req_user"></marker>
<tag>{require_user, [string()]}</tag>
<item>
- Defines users which should be granted access to a given
- directory using a secret password.
+ <p>Defines users which should be granted access to a given
+ directory using a secret password. </p>
</item>
+ <marker id="prop_req_grp"></marker>
<tag>{require_group, [string()]}</tag>
<item>
- Defines users which should be granted access to a given
- directory using a secret password.
+ <p>Defines users which should be granted access to a given
+ directory using a secret password. </p>
</item>
</taglist>
- <marker id="htaccess_prop"></marker>
+ <marker id="props_htaccess"></marker>
<p><em>Htaccess authentication properties - requires mod_htaccess</em></p>
<taglist>
+ <marker id="prop_access_files"></marker>
<tag>{access_files, [path()]}</tag>
-
- <item> Specify which filenames that are used for
+ <item>
+ <p>Specify which filenames that are used for
access-files. When a request comes every directory in the path
to the requested asset will be searched after files with the
names specified by this parameter. If such a file is found the
file will be parsed and the restrictions specified in it will
- be applied to the request.
+ be applied to the request. </p>
</item>
</taglist>
- <marker id="sec_prop"></marker>
+ <marker id="props_sec"></marker>
<p><em>Security properties - requires mod_security </em></p>
+ <marker id="prop_sec_dir"></marker>
<p><em>{security_directory, {path(), [{property(), term()}]}</em></p>
- <marker id="sdir_prop"></marker>
- <p> Here follows the valid properties for security directories</p>
+ <marker id="props_sdir"></marker>
+ <p>Here follows the valid properties for security directories</p>
<taglist>
- <tag>{data_file, path()}</tag>
-
+ <marker id="prop_data_file"></marker>
+ <tag>{data_file, path()}</tag>
<item>
- Name of the security data file. The filename can either
+ <p>Name of the security data file. The filename can either
absolute or relative to the server_root. This file is used to
- store persistent data for the mod_security module. </item>
-
- <tag>{max_retries, integer()}</tag>
+ store persistent data for the mod_security module. </p>
+ </item>
- <item> Specifies the maximum number of tries to authenticate a
+ <marker id="prop_max_retries"></marker>
+ <tag>{max_retries, integer()}</tag>
+ <item>
+ <p>Specifies the maximum number of tries to authenticate a
user has before the user is blocked out. If a user
successfully authenticates when the user has been blocked, the
user will receive a 403 (Forbidden) response from the
server. If the user makes a failed attempt while blocked the
server will return 401 (Unauthorized), for security
- reasons. Defaults to 3 may also be set to infinity.</item>
+ reasons.
+ Defaults to 3 may also be set to infinity. </p>
+ </item>
+ <marker id="prop_block_time"></marker>
<tag>{block_time, integer()}</tag>
-
- <item> Specifies the number of minutes a user is blocked. After
+ <item>
+ <p>Specifies the number of minutes a user is blocked. After
this amount of time, he automatically regains access.
- Defaults to 60</item>
+ Defaults to 60. </p>
+ </item>
+ <marker id="prop_fail_exp_time"></marker>
<tag>{fail_expire_time, integer()}</tag>
-
<item>
- Specifies the number of minutes a failed user authentication
+ <p>Specifies the number of minutes a failed user authentication
is remembered. If a user authenticates after this amount of
time, his previous failed authentications are
- forgotten. Defaults to 30</item>
+ forgotten.
+ Defaults to 30. </p>
+ </item>
+ <marker id="prop_auth_timeout"></marker>
<tag>{auth_timeout, integer()}</tag>
-
<item>
Specifies the number of seconds a successful user
authentication is remembered. After this time has passed, the
@@ -835,6 +951,7 @@ bytes
<funcs>
<func>
+ <marker id="info1"></marker>
<name>info(Pid) -></name>
<name>info(Pid, Properties) -> [{Option, Value}]</name>
<fsummary>Fetches information about the HTTP server</fsummary>
@@ -858,6 +975,7 @@ bytes
</func>
<func>
+ <marker id="info2"></marker>
<name>info(Address, Port) -> </name>
<name>info(Address, Port, Properties) -> [{Option, Value}] </name>
<fsummary>Fetches information about the HTTP server</fsummary>
@@ -883,6 +1001,7 @@ bytes
</func>
<func>
+ <marker id="reload_config"></marker>
<name>reload_config(Config, Mode) -> ok | {error, Reason}</name>
<fsummary>Reloads the HTTP server configuration without
restarting the server.</fsummary>
@@ -1003,6 +1122,7 @@ bytes
</section>
<funcs>
<func>
+ <marker id="module_do"></marker>
<name>Module:do(ModData)-> {proceed, OldData} | {proceed, NewData} | {break, NewData} | done</name>
<fsummary>Called for each request to the Web server.</fsummary>
<type>
@@ -1046,7 +1166,9 @@ bytes
closing the connection.</p>
</desc>
</func>
+
<func>
+ <marker id="module_load"></marker>
<name>Module:load(Line, AccIn)-> eof | ok | {ok, AccOut} | {ok, AccOut, {Option, Value}} | {ok, AccOut, [{Option, Value}]} | {error, Reason} </name>
<fsummary>Load is used to convert a line in a Apache like config
file to a <c>{Option, Value}</c> tuple.</fsummary>
@@ -1068,7 +1190,9 @@ bytes
</p>
</desc>
</func>
+
<func>
+ <marker id="module_store"></marker>
<name>Module:store({Option, Value}, Config)-> {ok, {Option, NewValue}} | {error, Reason} </name>
<fsummary></fsummary>
<type>
@@ -1092,6 +1216,7 @@ bytes
</func>
<func>
+ <marker id="module_remove"></marker>
<name>Module:remove(ConfigDB) -> ok | {error, Reason} </name>
<fsummary>Callback function that is called when the Web server is closed.</fsummary>
<type>
@@ -1112,6 +1237,7 @@ bytes
</section>
<funcs>
<func>
+ <marker id="parse_query"></marker>
<name>parse_query(QueryString) -> [{Key,Value}]</name>
<fsummary>Parse incoming data to <c>erl </c>and <c>eval </c>scripts.</fsummary>
<type>
@@ -1120,7 +1246,6 @@ bytes
<v>Value = string()</v>
</type>
<desc>
- <marker id="parse_query"></marker>
<p><c>parse_query/1</c> parses incoming data to <c>erl</c> and
<c>eval</c> scripts (See <seealso marker="mod_esi">mod_esi(3)</seealso>) as defined in the standard
URL format, that is '+' becomes 'space' and decoding of
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index cfc58b8ddb..2c96c43efb 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -33,6 +33,67 @@
</header>
+ <section><title>Inets 5.9</title>
+
+ <section><title>Improvements and New Features</title>
+<!--
+ <p>-</p>
+-->
+
+ <list>
+ <item>
+ <p>[httpd] Make the server header configurable with new config
+ option
+ <seealso marker="httpd#prop_server_tokens">server_tokens</seealso>.
+ The value of the server header, which was previously hard-coded
+ (at compile time), is now possible to manipulate through the means
+ of the
+ <seealso marker="httpd#prop_server_tokens">server_tokens</seealso>
+ config option. </p>
+ <p>Own Id: OTP-9805</p>
+ </item>
+
+ </list>
+
+ </section>
+
+ <section><title>Fixed Bugs and Malfunctions</title>
+ <p>-</p>
+
+<!--
+ <list>
+ <item>
+ <p>[httpd] Fix logging of content length in mod_log. </p>
+ <p>Garrett Smith</p>
+ <p>Own Id: OTP-9715</p>
+ </item>
+
+ </list>
+-->
+
+ </section>
+
+ <section>
+ <title>Incompatibilities</title>
+ <p>-</p>
+
+<!--
+ <list>
+ <item>
+ <p>[httpc|httpd] The old ssl implementation (based on OpenSSL),
+ has been deprecated. The config option that specified usage of
+ this version of the ssl app, <c>ossl</c>, has been removed. </p>
+ <p>Own Id: OTP-9522</p>
+ </item>
+
+ </list>
+-->
+
+ </section>
+
+ </section> <!-- 5.9 -->
+
+
<section><title>Inets 5.8.1</title>
<section><title>Improvements and New Features</title>
<p>-</p>
@@ -417,7 +478,7 @@
<p><c>ossl</c> will work for as long as the ssl application
supports it. </p>
<p>See the httpd
- <seealso marker="httpd#comm_prop">socket_type</seealso>
+ <seealso marker="httpd#props_comm">socket_type</seealso>
communication property or the httpc
<seealso marker="httpc#request2">request/4,5</seealso> function
for more info. </p>
@@ -436,7 +497,7 @@
<list>
<item>
<p>[httpd] Wrong
- <seealso marker="httpd#sec_prop">security property</seealso>
+ <seealso marker="httpd#props_sec">security property</seealso>
names used in documentation. </p>
<p><c>security_data_file</c> used instead of <c>data_file</c>. </p>
<p><c>security_max_retries</c> used instead of <c>max_retries</c>. </p>
@@ -620,7 +681,7 @@
the <c>essl</c> tag instead. </p>
<p>See the <c>http_option</c> option in the
<seealso marker="httpc#request2">request/4,5</seealso> or
- the <seealso marker="httpd#comm_prop">socket-type</seealso>
+ the <seealso marker="httpd#props_comm">socket-type</seealso>
section of the Communication properties chapter for more info, </p>
<p>Own Id: OTP-7907</p>
</item>
@@ -637,9 +698,9 @@
<p>[httpd] - Improved mod_alias.
Now able to do better URL rewrites. </p>
<p>See
- <seealso marker="httpd#alias_prop">URL aliasing properties</seealso>
+ <seealso marker="httpd#props_alias">URL aliasing properties</seealso>
and the
- <seealso marker="httpd#cgi_prop">CGI properties</seealso>
+ <seealso marker="httpd#props_cgi">CGI properties</seealso>
section(s) for more info, </p>
<p>Own Id: OTP-8573</p>
</item>
@@ -1225,7 +1286,7 @@
<p>Default is <c>inet6fb4</c> which emulates the
behaviour of the previous version. </p>
<p>See the
- <seealso marker="httpd#comm_prop">Communication properties</seealso>
+ <seealso marker="httpd#props_comm">Communication properties</seealso>
section for more info. </p>
<p>Own Id: OTP-8069</p>
<p>Aux Id: seq11086</p>
diff --git a/lib/inets/src/http_server/Makefile b/lib/inets/src/http_server/Makefile
index 55cc68dede..c341a2cec7 100644
--- a/lib/inets/src/http_server/Makefile
+++ b/lib/inets/src/http_server/Makefile
@@ -88,6 +88,8 @@ ERL_FILES = $(MODULES:%=%.erl)
TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+INETS_FLAGS = -D'SERVER_SOFTWARE="$(APPLICATION)/$(VSN)"'
+
# ----------------------------------------------------
# FLAGS
diff --git a/lib/inets/src/http_server/httpd_conf.erl b/lib/inets/src/http_server/httpd_conf.erl
index 7646300409..2ffd134d3d 100644
--- a/lib/inets/src/http_server/httpd_conf.erl
+++ b/lib/inets/src/http_server/httpd_conf.erl
@@ -210,12 +210,32 @@ load("MaxBodySize " ++ MaxBodySize, []) ->
{ok, Integer} ->
{ok, [], {max_body_size,Integer}};
{error, _} ->
- {error, ?NICE(clean(MaxBodySize)++
+ {error, ?NICE(clean(MaxBodySize) ++
" is an invalid number of MaxBodySize")}
end;
load("ServerName " ++ ServerName, []) ->
- {ok,[],{server_name,clean(ServerName)}};
+ {ok,[], {server_name, clean(ServerName)}};
+
+load("ServerTokens " ++ ServerTokens, []) ->
+ %% These are the valid *plain* server tokens:
+ %% sprod, major, minor, minimum, os, full
+ %% It can also be a "private" server token: private:<any string>
+ case string:tokens(ServerTokens, [$:]) of
+ ["private", Private] ->
+ {ok,[], {server_tokens, clean(Private)}};
+ [TokStr] ->
+ Tok = list_to_atom(clean(TokStr)),
+ case lists:member(Tok, [prod, major, minor, minimum, os, full]) of
+ true ->
+ {ok,[], {server_tokens, Tok}};
+ false ->
+ {error, ?NICE(clean(ServerTokens) ++
+ " is an invalid ServerTokens")}
+ end;
+ _ ->
+ {error, ?NICE(clean(ServerTokens) ++ " is an invalid ServerTokens")}
+ end;
load("SocketType " ++ SocketType, []) ->
%% ssl is the same as HTTP_DEFAULT_SSL_KIND
@@ -537,6 +557,20 @@ validate_config_params([{server_name, Value} | Rest])
validate_config_params([{server_name, Value} | _]) ->
throw({server_name, Value});
+validate_config_params([{server_tokens, Value} | Rest])
+ when is_atom(Value) ->
+ case lists:member(Value, plain_server_tokens()) of
+ true ->
+ validate_config_params(Rest);
+ false ->
+ throw({server_tokens, Value})
+ end;
+validate_config_params([{server_tokens, {private, Value}} | Rest])
+ when is_list(Value) ->
+ validate_config_params(Rest);
+validate_config_params([{server_tokens, Value} | _]) ->
+ throw({server_tokens, Value});
+
validate_config_params([{socket_type, Value} | Rest])
when (Value =:= ip_comm) orelse
(Value =:= ssl) orelse
@@ -737,9 +771,73 @@ store({log_format, LogFormat}, _ConfigList)
store({log_format, LogFormat}, _ConfigList)
when (LogFormat =:= compact) orelse (LogFormat =:= pretty) ->
{ok, {log_format, LogFormat}};
+store({server_tokens, ServerTokens} = Entry, _ConfigList) ->
+ Server = server(ServerTokens),
+ {ok, [Entry, {server, Server}]};
store(ConfigListEntry, _ConfigList) ->
{ok, ConfigListEntry}.
+
+%% The SERVER_SOFTWARE macro has the following structure:
+%% <product>/<version>
+%% Example: "inets/1.2.3"
+%% So, with this example (on a linux machine, with OTP R15B),
+%% this will result in:
+%% prod: "inets"
+%% major: "inets/1"
+%% minor: "inets/1.2"
+%% minimal: "inets/1.2.3"
+%% os: "inets/1.2.3 (unix)
+%% full: "inets/1.2.3 (unix/linux) OTP/R15B"
+%% Note that the format of SERVER_SOFTWARE is that of 'minimal'.
+%% Also, there will always be atleast two digits in a version:
+%% Not just 1 but 1.0
+%%
+%% We have already checked that the value is valid,
+%% so there is no need to check enything here.
+%%
+server(prod = _ServerTokens) ->
+ [Prod|_Version] = string:tokens(?SERVER_SOFTWARE, [$/]),
+ Prod;
+server(major = _ServerTokens) ->
+ [Prod|Version] = string:tokens(?SERVER_SOFTWARE, [$/]),
+ [Major|_] = string:tokens(Version, [$.]),
+ Prod ++ "/" ++ Major;
+server(minor = _ServerTokens) ->
+ [Prod|Version] = string:tokens(?SERVER_SOFTWARE, [$/]),
+ [Major,Minor|_] = string:tokens(Version, [$.]),
+ Prod ++ "/" ++ Major ++ "." ++ Minor;
+server(minimal = _ServerTokens) ->
+ %% This is the default
+ ?SERVER_SOFTWARE;
+server(os = _ServerTokens) ->
+ OS = os_info(partial),
+ lists:flatten(io_lib:format("~s ~s", [?SERVER_SOFTWARE, OS]));
+server(full = _ServerTokens) ->
+ OTPRelease = otp_release(),
+ OS = os_info(full),
+ lists:flatten(
+ io_lib:format("~s ~s OTP/~s", [?SERVER_SOFTWARE, OS, OTPRelease]));
+server({private, Server} = _ServerTokens) when is_list(Server) ->
+ %% The user provide its own
+ Server;
+server(_) ->
+ ?SERVER_SOFTWARE.
+
+os_info(Info) ->
+ case os:type() of
+ {OsFamily, _OsName} when Info =:= partial ->
+ lists:flatten(io_lib:format("(~w)", [OsFamily]));
+ {OsFamily, OsName} ->
+ lists:flatten(io_lib:format("(~w/~w)", [OsFamily, OsName]));
+ OsFamily ->
+ lists:flatten(io_lib:format("(~w)", [OsFamily]))
+ end.
+
+otp_release() ->
+ erlang:system_info(otp_release).
+
+
%% Phase 3: Remove
remove_all(ConfigDB) ->
Modules = httpd_util:lookup(ConfigDB,modules,[]),
@@ -1159,6 +1257,10 @@ ssl_ca_certificate_file(ConfigDB) ->
[{cacertfile, File}]
end.
+plain_server_tokens() ->
+ [prod, major, minor, minimum, os, full].
+
error_report(Where,M,F,Error) ->
error_logger:error_report([{?MODULE, Where},
{apply, {M, F, []}}, Error]).
+
diff --git a/lib/inets/src/http_server/httpd_response.erl b/lib/inets/src/http_server/httpd_response.erl
index dd7223876e..2dedb088e4 100644
--- a/lib/inets/src/http_server/httpd_response.erl
+++ b/lib/inets/src/http_server/httpd_response.erl
@@ -144,10 +144,14 @@ send_response(ModData, Header, Body) ->
end
end.
-send_header(#mod{socket_type = Type, socket = Sock,
- http_version = Ver, connection = Conn} = _ModData,
+send_header(#mod{socket_type = Type,
+ socket = Sock,
+ http_version = Ver,
+ connection = Conn,
+ config_db = ConfigDb} = _ModData,
StatusCode, KeyValueTupleHeaders) ->
- Headers = create_header(lists:map(fun transform/1, KeyValueTupleHeaders)),
+ Headers = create_header(ConfigDb,
+ lists:map(fun transform/1, KeyValueTupleHeaders)),
NewVer = case {Ver, StatusCode} of
{[], _} ->
%% May be implicit!
@@ -275,13 +279,20 @@ cache_headers(#mod{config_db = Db}) ->
[]
end.
-create_header(KeyValueTupleHeaders) ->
- NewHeaders = add_default_headers([{"date", httpd_util:rfc1123_date()},
- {"content-type", "text/html"},
- {"server", ?SERVER_SOFTWARE}],
- KeyValueTupleHeaders),
+create_header(ConfigDb, KeyValueTupleHeaders) ->
+ Date = httpd_util:rfc1123_date(),
+ ContentType = "text/html",
+ Server = server(ConfigDb),
+ NewHeaders = add_default_headers([{"date", Date},
+ {"content-type", ContentType},
+ {"server", Server}],
+ KeyValueTupleHeaders),
lists:map(fun fix_header/1, NewHeaders).
+
+server(ConfigDb) ->
+ httpd_util:lookup(ConfigDb, server, ?SERVER_SOFTWARE).
+
fix_header({Key0, Value}) ->
%% make sure first letter is capital
Words1 = string:tokens(Key0, "-"),
diff --git a/lib/inets/src/http_server/httpd_script_env.erl b/lib/inets/src/http_server/httpd_script_env.erl
index d3115150b0..a5613ba4a4 100644
--- a/lib/inets/src/http_server/httpd_script_env.erl
+++ b/lib/inets/src/http_server/httpd_script_env.erl
@@ -50,29 +50,44 @@ create_env(ScriptType, ModData, ScriptElements) ->
%%%========================================================================
%%% Internal functions
%%%========================================================================
+
+which_server(#mod{config_db = ConfigDb}) ->
+ httpd_util:lookup(ConfigDb, server, ?SERVER_SOFTWARE).
+
+which_port(#mod{config_db = ConfigDb}) ->
+ httpd_util:lookup(ConfigDb, port, 80).
+
+which_peername(#mod{init_data = #init_data{peername = {_, RemoteAddr}}}) ->
+ RemoteAddr.
+
+which_resolve(#mod{init_data = #init_data{resolve = Resolve}}) ->
+ Resolve.
+
+which_method(#mod{method = Method}) ->
+ Method.
+
+which_request_uri(#mod{request_uri = RUri}) ->
+ RUri.
+
create_basic_elements(esi, ModData) ->
- {_, RemoteAddr} = (ModData#mod.init_data)#init_data.peername,
- [{server_software, ?SERVER_SOFTWARE},
- {server_name, (ModData#mod.init_data)#init_data.resolve},
- {gateway_interface,?GATEWAY_INTERFACE},
- {server_protocol, ?SERVER_PROTOCOL},
- {server_port, httpd_util:lookup(ModData#mod.config_db,port,80)},
- {request_method, ModData#mod.method},
- {remote_addr, RemoteAddr},
- {script_name, ModData#mod.request_uri}];
+ [{server_software, which_server(ModData)},
+ {server_name, which_resolve(ModData)},
+ {gateway_interface, ?GATEWAY_INTERFACE},
+ {server_protocol, ?SERVER_PROTOCOL},
+ {server_port, which_port(ModData)},
+ {request_method, which_method(ModData)},
+ {remote_addr, which_peername(ModData)},
+ {script_name, which_request_uri(ModData)}];
create_basic_elements(cgi, ModData) ->
- {_, RemoteAddr} = (ModData#mod.init_data)#init_data.peername,
- [{"SERVER_SOFTWARE",?SERVER_SOFTWARE},
- {"SERVER_NAME", (ModData#mod.init_data)#init_data.resolve},
- {"GATEWAY_INTERFACE",?GATEWAY_INTERFACE},
- {"SERVER_PROTOCOL",?SERVER_PROTOCOL},
- {"SERVER_PORT",
- integer_to_list(httpd_util:lookup(
- ModData#mod.config_db, port, 80))},
- {"REQUEST_METHOD", ModData#mod.method},
- {"REMOTE_ADDR", RemoteAddr},
- {"SCRIPT_NAME", ModData#mod.request_uri}].
+ [{"SERVER_SOFTWARE", which_server(ModData)},
+ {"SERVER_NAME", which_resolve(ModData)},
+ {"GATEWAY_INTERFACE", ?GATEWAY_INTERFACE},
+ {"SERVER_PROTOCOL", ?SERVER_PROTOCOL},
+ {"SERVER_PORT", integer_to_list(which_port(ModData))},
+ {"REQUEST_METHOD", which_method(ModData)},
+ {"REMOTE_ADDR", which_peername(ModData)},
+ {"SCRIPT_NAME", which_request_uri(ModData)}].
create_http_header_elements(ScriptType, Headers) ->
create_http_header_elements(ScriptType, Headers, []).
@@ -80,7 +95,7 @@ create_http_header_elements(ScriptType, Headers) ->
create_http_header_elements(_, [], Acc) ->
Acc;
create_http_header_elements(ScriptType, [{Name, [Value | _] = Values } |
- Headers], Acc)
+ Headers], Acc)
when is_list(Value) ->
NewName = lists:map(fun(X) -> if X == $- -> $_; true -> X end end, Name),
Element = http_env_element(ScriptType, NewName, multi_value(Values)),
diff --git a/lib/inets/src/inets_app/inets.mk b/lib/inets/src/inets_app/inets.mk
index 194b4ca2b1..d24cc0aea3 100644
--- a/lib/inets/src/inets_app/inets.mk
+++ b/lib/inets/src/inets_app/inets.mk
@@ -41,8 +41,6 @@ INETS_APP_VSN_COMPILE_FLAGS = \
+'{parse_transform,sys_pre_attributes}' \
+'{attribute,insert,app_vsn,$(APP_VSN)}'
-INETS_FLAGS = -D'SERVER_SOFTWARE="$(APPLICATION)/$(VSN)"'
-
INETS_ERL_COMPILE_FLAGS += \
-pa $(ERL_TOP)/lib/inets/ebin \
$(INETS_APP_VSN_COMPILE_FLAGS)
diff --git a/lib/inets/vsn.mk b/lib/inets/vsn.mk
index 77eb43a7ed..488947c3a1 100644
--- a/lib/inets/vsn.mk
+++ b/lib/inets/vsn.mk
@@ -18,7 +18,7 @@
# %CopyrightEnd%
APPLICATION = inets
-INETS_VSN = 5.8.1
+INETS_VSN = 5.9
PRE_VSN =
APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)"