diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/inets/doc/src/httpc.xml | 3 | ||||
-rw-r--r-- | lib/inets/doc/src/mod_security.xml | 17 | ||||
-rw-r--r-- | lib/inets/doc/src/notes.xml | 64 | ||||
-rw-r--r-- | lib/inets/src/http_client/httpc_handler.erl | 35 | ||||
-rw-r--r-- | lib/inets/src/http_server/httpd_conf.erl | 2 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_esi.erl | 26 | ||||
-rw-r--r-- | lib/inets/src/inets_app/inets.appup.src | 12 | ||||
-rw-r--r-- | lib/inets/vsn.mk | 6 |
8 files changed, 136 insertions, 29 deletions
diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index ca93190f61..7430a62b1b 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -191,7 +191,8 @@ ssl_options() = {verify, code()} | <v>Result = {status_line(), headers(), body()} | {status_code(), body()} | request_id() </v> <v>Profile = profile() </v> - <v>Reason = term() </v> + <v>Reason = {connect_failed, term()} | + {send_failed, term()} | term() </v> </type> <desc> diff --git a/lib/inets/doc/src/mod_security.xml b/lib/inets/doc/src/mod_security.xml index 5f9f88071e..2a871d29d8 100644 --- a/lib/inets/doc/src/mod_security.xml +++ b/lib/inets/doc/src/mod_security.xml @@ -4,7 +4,7 @@ <erlref> <header> <copyright> - <year>1998</year><year>2009</year> + <year>1998</year><year>2010</year> <holder>Ericsson AB. All Rights Reserved.</holder> </copyright> <legalnotice> @@ -13,12 +13,12 @@ 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_security</title> @@ -117,11 +117,14 @@ <section> <marker id="callback_module"></marker> <title>The SecurityCallbackModule</title> - <p>The SecurityCallbackModule is a user written module that can receive events from - the mod_security Erlang Webserver API module. This module only exports one function, - <seealso marker="#callback_module_event">event/4</seealso>, which is described below. + <p>The SecurityCallbackModule is a user written module that can receive + events from the mod_security Erlang Webserver API module. + This module only exports the function(s), + <seealso marker="#callback_module_event">event/4,5</seealso>, + which are described below. </p> </section> + <funcs> <func> <name>event(What, Port, Dir, Data) -> ignored</name> @@ -131,7 +134,7 @@ <v>What = atom()</v> <v>Port = integer()</v> <v>Address = {A,B,C,D} | string() <v>Dir = string()</v> - <v>What = [Info]</v> + <v>Data = [Info]</v> <v>Info = {Name, Value}</v> </type> <desc> diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml index 0c524f00d1..762c2c84c5 100644 --- a/lib/inets/doc/src/notes.xml +++ b/lib/inets/doc/src/notes.xml @@ -32,6 +32,70 @@ <file>notes.xml</file> </header> + <section><title>Inets 5.3.1</title> + + <section><title>Improvements and New Features</title> + <p>-</p> + +<!-- + <list> + <item> + <p>[httpc] - Allow users to pass socket options to the transport + module when making requests. </p> + <p>See the <c>socket_opts</c> option in the + <seealso marker="httpc#request2">request/4</seealso> or + <seealso marker="httpc#set_options">set_options/1,2</seealso> + for more info, </p> + <p>Own Id: OTP-8352</p> + </item> + + </list> +--> + </section> + + <section><title>Fixed Bugs and Malfunctions</title> + +<!-- + <p>-</p> +--> + + <list> + <item> + <p>[httpc] - Badly formated error reason for errors occuring + during initial connect to a server. + Also, the possible error reasons was + not properly documented.</p> + <p>Own Id: OTP-8508</p> + <p>Aux Id: seq11407</p> + </item> + + <item> + <p>[httpd] - Issues with ESI erl_script_timeout. </p> + <p> + <list type="bulleted"> + <item> + <p>The <c>erl_script_timeout</c> config option is ducumented + as a number of seconds. But when parsing the config, in the + new format (not a config file), it was handled as if in + number of milliseconds. </p> + </item> + <item> + <p>When the erl-script-timeout time was exceeded, the server + incorrectly marked the answer as sent, thereby leaving + client hanging (with an incomplete answer). + This has been changed, so that now the socket will be + closed. </p> + </item> + </list> + </p> + <p>Own Id: OTP-8509</p> + </item> + </list> + </section> + + </section> <!-- 5.3.1 --> + + <section><title>Inets 5.3</title> <section><title>Improvements and New Features</title> diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl index 31585537d4..695ff9cf82 100644 --- a/lib/inets/src/http_client/httpc_handler.erl +++ b/lib/inets/src/http_client/httpc_handler.erl @@ -280,7 +280,7 @@ handle_call({connect_and_send, #request{address = Address0, {ok, NewState} -> {reply, ok, NewState}; {stop, Error, NewState} -> - {stop, Error, Error, NewState} + {stop, normal, Error, NewState} end end; @@ -675,6 +675,24 @@ handle_info({'EXIT', _, _}, State) -> %%-------------------------------------------------------------------- %% Init error there is no socket to be closed. +terminate(normal, + #state{request = Request, + session = {send_failed, AReason} = Reason} = State) -> + ?hcrd("terminate", [{send_reason, AReason}, {request, Request}]), + maybe_send_answer(Request, + httpc_response:error(Request, Reason), + State), + ok; + +terminate(normal, + #state{request = Request, + session = {connect_failed, AReason} = Reason} = State) -> + ?hcrd("terminate", [{connect_reason, AReason}, {request, Request}]), + maybe_send_answer(Request, + httpc_response:error(Request, Reason), + State), + ok; + terminate(normal, #state{session = undefined}) -> ok; @@ -886,18 +904,17 @@ connect_and_send_first_request(Address, NewState = activate_request_timeout(TmpState), {ok, NewState}; - {error, Reason} -> + {error, Reason} = Error -> ?hcrv("failed sending request", [{reason, Reason}]), - Error = {error, {send_failed, - httpc_response:error(Request, Reason)}}, - {stop, Error, State#state{request = Request}} + {stop, Error, + State#state{session = {send_failed, Reason}, + request = Request}} end; - {error, Reason} -> + {error, Reason} = Error -> ?hcri("connect failed", [{reason, Reason}]), - Error = {error, {connect_failed, - httpc_response:error(Request, Reason)}}, - {stop, Error, State#state{request = Request}} + {stop, Error, State#state{session = {connect_failed, Reason}, + request = Request}} end. diff --git a/lib/inets/src/http_server/httpd_conf.erl b/lib/inets/src/http_server/httpd_conf.erl index 3e498d1db7..5ca2e47eb5 100644 --- a/lib/inets/src/http_server/httpd_conf.erl +++ b/lib/inets/src/http_server/httpd_conf.erl @@ -354,7 +354,7 @@ load("DocumentRoot " ++ DocumentRoot,[]) -> {ok, Directory} -> {ok, [], {document_root,string:strip(Directory,right,$/)}}; {error, _} -> - {error, ?NICE(clean(DocumentRoot)++"is an invalid DocumentRoot")} + {error, ?NICE(clean(DocumentRoot)++" is an invalid DocumentRoot")} end; load("DefaultType " ++ DefaultType, []) -> {ok, [], {default_type,clean(DefaultType)}}; diff --git a/lib/inets/src/http_server/mod_esi.erl b/lib/inets/src/http_server/mod_esi.erl index 484d4b3fb4..cb33544540 100644 --- a/lib/inets/src/http_server/mod_esi.erl +++ b/lib/inets/src/http_server/mod_esi.erl @@ -33,6 +33,7 @@ -define(VMODULE,"ESI"). -define(DEFAULT_ERL_TIMEOUT,15000). + %%%========================================================================= %%% API %%%========================================================================= @@ -52,6 +53,7 @@ deliver(SessionID, Data) when is_pid(SessionID) -> deliver(_SessionID, _Data) -> {error, bad_sessionID}. + %%%========================================================================= %%% CALLBACK API %%%========================================================================= @@ -74,6 +76,8 @@ do(ModData) -> {proceed, ModData#mod.data} end end. + + %%-------------------------------------------------------------------------- %% load(Line, Context) -> eof | ok | {ok, NewContext} | %% {ok, NewContext, Directive} | @@ -127,6 +131,7 @@ load("ErlScriptNoCache " ++ CacheArg, [])-> " is an invalid ErlScriptNoCache directive")} end. + %%-------------------------------------------------------------------------- %% store(Directive, DirectiveList) -> {ok, NewDirective} | %% {ok, [NewDirective]} | @@ -163,16 +168,18 @@ store({eval_script_alias, {Name, Modules}} = Conf, _) store({erl_script_alias, Value}, _) -> {error, {wrong_type, {erl_script_alias, Value}}}; -store({erl_script_timeout, Value} = Conf, _) - when is_integer(Value), Value >= 0 -> - {ok, Conf}; +store({erl_script_timeout, TimeoutSec}, _) + when is_integer(TimeoutSec) andalso (TimeoutSec >= 0) -> + {ok, {erl_script_timeout, TimeoutSec * 1000}}; store({erl_script_timeout, Value}, _) -> {error, {wrong_type, {erl_script_timeout, Value}}}; -store({erl_script_nocache, Value} = Conf, _) when Value == true; - Value == false -> +store({erl_script_nocache, Value} = Conf, _) + when (Value =:= true) orelse (Value =:= false) -> {ok, Conf}; store({erl_script_nocache, Value}, _) -> {error, {wrong_type, {erl_script_nocache, Value}}}. + + %%%======================================================================== %%% Internal functions %%%======================================================================== @@ -227,7 +234,7 @@ alias_match_str(Alias, eval_script_alias) -> %%------------------------ Erl mechanism -------------------------------- erl(#mod{method = Method} = ModData, ESIBody, Modules) - when Method == "GET"; Method == "HEAD"-> + when (Method =:= "GET") orelse (Method =:= "HEAD") -> case httpd_util:split(ESIBody,":|%3A|/",2) of {ok, [ModuleName, FuncAndInput]} -> case httpd_util:split(FuncAndInput,"[\?/]",2) of @@ -347,7 +354,7 @@ erl_scheme_webpage_chunk(Mod, Func, Env, Input, ModData) -> Pid = spawn_link( fun() -> case catch Mod:Func(Self, Env, Input) of - {'EXIT',{undef,_}} -> + {'EXIT', {undef,_}} -> %% Will force fallback on the old API exit(erl_scheme_webpage_chunk_undefined); _ -> @@ -430,11 +437,12 @@ handle_body(Pid, ModData, Body, Timeout, Size, IsDisableChunkedSend) -> {proceed, [{response, {already_sent, 200, Size}} | ModData#mod.data]}; {'EXIT', Pid, Reason} when is_pid(Pid) -> + httpd_response:send_final_chunk(ModData, IsDisableChunkedSend), exit({mod_esi_linked_process_died, Pid, Reason}) after Timeout -> process_flag(trap_exit,false), - {proceed,[{response, {already_sent, 200, Size}} | - ModData#mod.data]} + httpd_response:send_final_chunk(ModData, IsDisableChunkedSend), + exit({mod_esi_linked_process_timeout, Pid}) end. erl_script_timeout(Db) -> diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src index 2efa7ccb60..ba1dc8ccdb 100644 --- a/lib/inets/src/inets_app/inets.appup.src +++ b/lib/inets/src/inets_app/inets.appup.src @@ -18,6 +18,12 @@ {"%VSN%", [ + {"5.3", + [ + {update, httpc_handler, soft, soft_purge, soft_purge, [mod_esi]}, + {load_module, mod_esi, soft_purge, soft_purge, []} + ] + }, {"5.2", [ {restart_application, inets} @@ -35,6 +41,12 @@ } ], [ + {"5.3", + [ + {update, httpc_handler, soft, soft_purge, soft_purge, [mod_esi]}, + {load_module, mod_esi, soft_purge, soft_purge, []} + ] + }, {"5.2", [ {restart_application, inets} diff --git a/lib/inets/vsn.mk b/lib/inets/vsn.mk index 23de8906e7..401bf4d37d 100644 --- a/lib/inets/vsn.mk +++ b/lib/inets/vsn.mk @@ -18,11 +18,13 @@ # %CopyrightEnd% APPLICATION = inets -INETS_VSN = 5.3 +INETS_VSN = 5.3.1 PRE_VSN = APP_VSN = "$(APPLICATION)-$(INETS_VSN)$(PRE_VSN)" -TICKETS = \ +TICKETS = OTP-8508 OTP-8509 + +TICKETS_5_3 = \ OTP-8016 \ OTP-8056 \ OTP-8103 \ |