File 0574-inets-Fix-handling-of-erl_script_timeout.patch of Package erlang

From bf48c2a3d49f06ecd670ba6b298f5910055aa5aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A9ter=20Dimitrov?= <peterdmv@erlang.org>
Date: Fri, 8 Mar 2019 13:29:30 +0100
Subject: [PATCH] inets: Fix handling of erl_script_timeout

When httpd was started with 'erl_script_timeout', the value of the
option was converted to milliseconds before storage. Subsequent
calls to httpd:info/1 returned the input value multiplied by 1000.

This change fixes the handing of erl_script_timeout by storing the
timeout in seconds and converting it to milliseconds before usage.

Change-Id: Ic308d83b59ad0884e053f096f995754c89adcbf4
---
 lib/inets/src/http_server/mod_esi.erl |  6 +++---
 lib/inets/test/httpd_SUITE.erl        | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/lib/inets/src/http_server/mod_esi.erl b/lib/inets/src/http_server/mod_esi.erl
index 443b7ee564..f495f12f03 100644
--- a/lib/inets/src/http_server/mod_esi.erl
+++ b/lib/inets/src/http_server/mod_esi.erl
@@ -34,7 +34,7 @@
 -include("inets_internal.hrl").
 
 -define(VMODULE,"ESI").
--define(DEFAULT_ERL_TIMEOUT,15000).
+-define(DEFAULT_ERL_TIMEOUT,15).
 
 
 %%%=========================================================================
@@ -176,7 +176,7 @@ store({erl_script_alias, Value}, _) ->
     {error, {wrong_type, {erl_script_alias, Value}}};
 store({erl_script_timeout, TimeoutSec}, _) 
   when is_integer(TimeoutSec) andalso (TimeoutSec >= 0) ->
-    {ok, {erl_script_timeout, TimeoutSec * 1000}};
+    {ok, {erl_script_timeout, TimeoutSec}};
 store({erl_script_timeout, Value}, _) ->
     {error, {wrong_type, {erl_script_timeout, Value}}};
 store({erl_script_nocache, Value} = Conf, _) 
@@ -516,7 +516,7 @@ kill_esi_delivery_process(Pid) ->
 	
 
 erl_script_timeout(Db) ->
-    httpd_util:lookup(Db, erl_script_timeout, ?DEFAULT_ERL_TIMEOUT).
+    httpd_util:lookup(Db, erl_script_timeout, ?DEFAULT_ERL_TIMEOUT * 1000).
 
 script_elements(FuncAndInput, Input) ->
     case input_type(FuncAndInput) of
diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl
index 5b6740fba3..fcb9ad7905 100644
--- a/lib/inets/test/httpd_SUITE.erl
+++ b/lib/inets/test/httpd_SUITE.erl
@@ -74,7 +74,8 @@ all() ->
      {group, https_reload},
      {group, http_mime_types},
      {group, http_logging},
-     mime_types_format
+     mime_types_format,
+     erl_script_timeout_option
     ].
 
 groups() ->
@@ -1580,6 +1581,19 @@ mime_types_format(Config) when is_list(Config) ->
      {"cpt","application/mac-compactpro"},
      {"hqx","application/mac-binhex40"}]} = httpd_conf:load_mime_types(MimeTypes).
 
+
+erl_script_timeout_option(Config) when is_list(Config) ->
+    inets:start(),
+    {ok, Pid} = inets:start(httpd, [{erl_script_timeout, 215},
+                                    {server_name, "test"},
+                                    {port,0},
+                                    {server_root, "."},
+                                    {document_root, "."}]),
+    Info = httpd:info(Pid),
+    215 = proplists:get_value(erl_script_timeout, Info),
+    inets:stop().
+
+
 %%--------------------------------------------------------------------
 %% Internal functions -----------------------------------
 %%--------------------------------------------------------------------
-- 
2.16.4

openSUSE Build Service is sponsored by