diff --git a/src/mochiweb.app.src b/src/mochiweb.app.src index 28eebf22..92214746 100644 --- a/src/mochiweb.app.src +++ b/src/mochiweb.app.src @@ -4,6 +4,5 @@ {vsn, "2.0.0"}, {modules, []}, {registered, []}, - {mod, {mochiweb_app, []}}, {env, []}, {applications, [kernel, stdlib, crypto, inets]}]}. diff --git a/src/mochiweb.erl b/src/mochiweb.erl index 536a12f8..f5eccc51 100644 --- a/src/mochiweb.erl +++ b/src/mochiweb.erl @@ -6,23 +6,9 @@ -module(mochiweb). -author('bob@mochimedia.com'). --export([start/0, stop/0]). -export([new_request/1, new_response/1]). -export([all_loaded/0, all_loaded/1, reload/0]). -%% @spec start() -> ok -%% @doc Start the MochiWeb server. -start() -> - ensure_started(crypto), - application:start(mochiweb). - -%% @spec stop() -> ok -%% @doc Stop the MochiWeb server. -stop() -> - Res = application:stop(mochiweb), - application:stop(crypto), - Res. - reload() -> [c:l(Module) || Module <- all_loaded()]. @@ -78,17 +64,6 @@ new_response({Request, Code, Headers}) -> Code, mochiweb_headers:make(Headers)). -%% Internal API - -ensure_started(App) -> - case application:start(App) of - ok -> - ok; - {error, {already_started, App}} -> - ok - end. - - %% %% Tests %% @@ -138,11 +113,11 @@ multiple_https_GET_test() -> do_GET(ssl, 3). hundred_http_GET_test_() -> % note the underscore - {timeout, ?LARGE_TIMEOUT, + {timeout, ?LARGE_TIMEOUT, fun() -> ?assertEqual(ok, do_GET(plain,100)) end}. hundred_https_GET_test_() -> % note the underscore - {timeout, ?LARGE_TIMEOUT, + {timeout, ?LARGE_TIMEOUT, fun() -> ?assertEqual(ok, do_GET(ssl,100)) end}. single_128_http_POST_test() -> @@ -170,11 +145,11 @@ multiple_100K_https_POST_test() -> do_POST(ssl, 102400, 3). hundred_128_http_POST_test_() -> % note the underscore - {timeout, ?LARGE_TIMEOUT, + {timeout, ?LARGE_TIMEOUT, fun() -> ?assertEqual(ok, do_POST(plain, 128, 100)) end}. hundred_128_https_POST_test_() -> % note the underscore - {timeout, ?LARGE_TIMEOUT, + {timeout, ?LARGE_TIMEOUT, fun() -> ?assertEqual(ok, do_POST(ssl, 128, 100)) end}. do_GET(Transport, Times) -> diff --git a/src/mochiweb_app.erl b/src/mochiweb_app.erl deleted file mode 100644 index 4b871576..00000000 --- a/src/mochiweb_app.erl +++ /dev/null @@ -1,27 +0,0 @@ -%% @author Bob Ippolito -%% @copyright 2007 Mochi Media, Inc. - -%% @doc Callbacks for the mochiweb application. - --module(mochiweb_app). --author('bob@mochimedia.com'). - --behaviour(application). --export([start/2,stop/1]). - -%% @spec start(_Type, _StartArgs) -> ServerRet -%% @doc application start callback for mochiweb. -start(_Type, _StartArgs) -> - mochiweb_sup:start_link(). - -%% @spec stop(_State) -> ServerRet -%% @doc application stop callback for mochiweb. -stop(_State) -> - ok. - -%% -%% Tests -%% --ifdef(TEST). --include_lib("eunit/include/eunit.hrl"). --endif. diff --git a/src/mochiweb_sup.erl b/src/mochiweb_sup.erl deleted file mode 100644 index ad24db65..00000000 --- a/src/mochiweb_sup.erl +++ /dev/null @@ -1,41 +0,0 @@ -%% @author Bob Ippolito -%% @copyright 2007 Mochi Media, Inc. - -%% @doc Supervisor for the mochiweb application. - --module(mochiweb_sup). --author('bob@mochimedia.com'). - --behaviour(supervisor). - -%% External exports --export([start_link/0, upgrade/0]). - -%% supervisor callbacks --export([init/1]). - -%% @spec start_link() -> ServerRet -%% @doc API for starting the supervisor. -start_link() -> - supervisor:start_link({local, ?MODULE}, ?MODULE, []). - -%% @spec upgrade() -> ok -%% @doc Add processes if necessary. -upgrade() -> - {ok, {_, Specs}} = init([]), - lists:foreach(fun(S) -> supervisor:start_child(?MODULE, S) end, Specs), - ok. - -%% @spec init([]) -> SupervisorTree -%% @doc supervisor callback, ensures yaws is in embedded mode and then -%% returns the supervisor tree. -init([]) -> - Processes = [], - {ok, {{one_for_one, 10, 10}, Processes}}. - -%% -%% Tests -%% --ifdef(TEST). --include_lib("eunit/include/eunit.hrl"). --endif.