Remove dependency on crypto in webmachine

This commit is contained in:
Emile Joubert 2010-12-20 10:37:26 +00:00
parent c202953e5c
commit 2ca1b5c639
3 changed files with 120 additions and 2 deletions

View File

@ -4,7 +4,7 @@ DEPS=rabbitmq-mochiweb rabbitmq-server rabbitmq-erlang-client rabbitmq-managemen
INTERNAL_DEPS=webmachine
RUNTIME_DEPS=webmachine
TEST_APPS=crypto inets mochiweb rabbit_mochiweb webmachine rabbit_management_agent amqp_client rabbit_management
TEST_APPS=inets mochiweb rabbit_mochiweb webmachine rabbit_management_agent amqp_client rabbit_management
TEST_ARGS=-rabbit_mochiweb port 55672
START_RABBIT_IN_TESTS=true
TEST_COMMANDS=rabbit_mgmt_test_all:all_tests()

View File

@ -0,0 +1,117 @@
diff -r 0c4b60ac68b4 demo/ebin/webmachine_demo.app
--- a/demo/ebin/webmachine_demo.app Tue Jun 15 08:36:55 2010 -0400
+++ b/demo/ebin/webmachine_demo.app Sat Dec 18 21:20:46 2010 +0000
@@ -11,4 +11,4 @@
{registered, []},
{mod, {webmachine_demo_app, []}},
{env, []},
- {applications, [kernel, stdlib, crypto]}]}.
+ {applications, [kernel, stdlib]}]}.
diff -r 0c4b60ac68b4 demo/src/demo_fs_resource.erl
--- a/demo/src/demo_fs_resource.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/demo/src/demo_fs_resource.erl Sat Dec 18 21:20:46 2010 +0000
@@ -143,7 +143,7 @@
{LMod, ReqData, Context#context{metadata=[{'last-modified',
httpd_util:rfc1123_date(LMod)}|Context#context.metadata]}}.
-hash_body(Body) -> mochihex:to_hex(binary_to_list(crypto:sha(Body))).
+hash_body(Body) -> mochihex:to_hex(binary_to_list(erlang:md5(Body))).
generate_etag(ReqData, Context) ->
case maybe_fetch_object(Context, wrq:disp_path(ReqData)) of
diff -r 0c4b60ac68b4 demo/src/webmachine_demo.erl
--- a/demo/src/webmachine_demo.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/demo/src/webmachine_demo.erl Sat Dec 18 21:20:46 2010 +0000
@@ -14,7 +14,6 @@
%% @spec start() -> ok
%% @doc Start the webmachine_demo server.
start() ->
- ensure_started(crypto),
ensure_started(webmachine),
application:start(webmachine_demo).
@@ -23,5 +22,4 @@
stop() ->
Res = application:stop(webmachine_demo),
application:stop(webmachine),
- application:stop(crypto),
Res.
diff -r 0c4b60ac68b4 ebin/webmachine.app
--- a/ebin/webmachine.app Tue Jun 15 08:36:55 2010 -0400
+++ b/ebin/webmachine.app Sat Dec 18 21:20:46 2010 +0000
@@ -25,4 +25,4 @@
{env, [
{dispatch_list, []}
]},
- {applications, [kernel, stdlib, crypto]}]}.
+ {applications, [kernel, stdlib]}]}.
diff -r 0c4b60ac68b4 priv/templates/ebin/wmskel.app
--- a/priv/templates/ebin/wmskel.app Tue Jun 15 08:36:55 2010 -0400
+++ b/priv/templates/ebin/wmskel.app Sat Dec 18 21:20:46 2010 +0000
@@ -13,7 +13,6 @@
{applications, [
kernel,
stdlib,
- crypto,
mochiweb,
webmachine
]},
diff -r 0c4b60ac68b4 priv/templates/src/wmskel.erl
--- a/priv/templates/src/wmskel.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/priv/templates/src/wmskel.erl Sat Dec 18 21:20:46 2010 +0000
@@ -18,7 +18,6 @@
%% @spec start_link() -> {ok,Pid::pid()}
%% @doc Starts the app for inclusion in a supervisor tree
start_link() ->
- ensure_started(crypto),
ensure_started(mochiweb),
application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
@@ -28,7 +27,6 @@
%% @spec start() -> ok
%% @doc Start the {{appid}} server.
start() ->
- ensure_started(crypto),
ensure_started(mochiweb),
application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
@@ -41,5 +39,4 @@
Res = application:stop({{appid}}),
application:stop(webmachine),
application:stop(mochiweb),
- application:stop(crypto),
Res.
diff -r 0c4b60ac68b4 scripts/run_tests.escript
--- a/scripts/run_tests.escript Tue Jun 15 08:36:55 2010 -0400
+++ b/scripts/run_tests.escript Sat Dec 18 21:20:46 2010 +0000
@@ -21,7 +21,6 @@
end,
proplists:get_value(modules, App)),
- crypto:start(),
start_cover(Modules),
eunit:test(Modules, [verbose]),
analyze_cover(Modules);
diff -r 0c4b60ac68b4 src/webmachine.erl
--- a/src/webmachine.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine.erl Sat Dec 18 21:20:46 2010 +0000
@@ -28,7 +28,6 @@
%% @doc Start the webmachine server.
start() ->
webmachine_deps:ensure(),
- application:start(crypto),
application:start(webmachine).
%% @spec stop() -> ok
diff -r 0c4b60ac68b4 src/webmachine_request.erl
--- a/src/webmachine_request.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine_request.erl Sat Dec 18 21:20:46 2010 +0000
@@ -560,7 +560,7 @@
{CT, _} ->
CT
end,
- Boundary = mochihex:to_hex(crypto:rand_bytes(8)),
+ Boundary = [96 + random:uniform(26) || _ <- lists:seq(1,70)],
HeaderList = [{"Content-Type",
["multipart/byteranges; ",
"boundary=", Boundary]}],

View File

@ -29,7 +29,8 @@ $(LIB_PACKAGE_DIR): $(CHECKOUT_DIR)
$(CHECKOUT_DIR):
rm -rf $@-tmp
hg clone -r $(REVISION) $(HG_UPSTREAM) $@-tmp
cd $@-tmp && patch -p1 < ../unrebar.patch && patch -p1 < ../uneunit.patch && cd .. && mv $@-tmp $@
cd $@-tmp && patch -p1 < ../unrebar.patch && patch -p1 < ../uneunit.patch && \
patch -p1 < ../10-crypto.patch && cd .. && mv $@-tmp $@
%.ez: $(LIB_PACKAGE_DIR)
$(MAKE) -C $(LIB_PACKAGE_DIR) clean all