[erlang-patches] [patch] httpd_sup.erl

Nicolas Charpentier nc@REDACTED
Tue Mar 23 09:54:44 CET 2010


Hi

I'm not sure that there was any problem in OTP.
According to the documentation (http://www.erlang.org/doc/man/httpd.html)
the configuration file must be an erlang list containing tuples {Option,
Value}.

Here is a correct configuration file:

$  cat test_ok.conf
[{port,8080},{server_name,"httpd_test"}].
$ erl
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.5.5  (abort with ^G)
1> file:consult("test_ok.conf").
{ok,[[{port,8080},{server_name,"httpd_test"}]]}


Reading your patch, I think that your configuration file looks like:
$  cat test_bad.conf
{port,8080}.
{server_name, "httpd_test"}.
$ erl
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.5.5  (abort with ^G)
1>file:consult("test_bad.conf").
{ok,[{port,8080},{server_name,"httpd_test"}]}



Regards,
Nicolas Charpentier

>
>  Problem:  Starting inets httpd service using proplist_file results in
> error as follows.
>
> Eshell V5.7.4  (abort with ^G)
> 1> inets:start().
> ok
> 2> inets:start(httpd, [{proplist_file, "priv/conf/httpd.conf"}]).
> ** exception error: no try clause matching
>                     {ok,[{port,8888},
>                          {server_name,"httpd_test"},
>
>                     ...
>
>      in function  httpd_sup:httpd_config/1
>      in call from httpd_sup:start_child/1
>      in call from inets:call_service/3
>
> -------------
>
>  Patch to httpd_sup.erl :
>
> [block]$ cat httpd_sup.erl.mcdaniel.patch
> --- /usr/local/lib/erlang/lib/inets-5.2/src/httpd_sup.erl.orig  2010-03-22
> 16:32:38.000000000 -0700
> +++ /usr/local/lib/erlang/lib/inets-5.2/src/httpd_sup.erl       2010-03-22
> 16:32:55.000000000 -0700
> @@ -148,7 +148,7 @@
>                     httpd_conf:validate_properties(Config);
>                 File ->
>                    try file:consult(File) of
> -                      {ok, [PropList]} ->
> +                      {ok, PropList} ->
>                            httpd_conf:validate_properties(PropList)
>                    catch
>                        exit:_ ->
>
> -------------
>
>  The above patch corrects the error.  Patch was created with
>
>    diff  -u  httpd_sup.erl.orig   httpd_sup.erl  >
> httpd_sup.erl.mcdaniel.patch
>
>
>  ~Michael
>
> --
> Michael McDaniel
> Portland, Oregon, USA
> http://trip.autosys.us
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@REDACTED
>
>



More information about the erlang-patches mailing list