Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge in rebar modifications

--HG--
rename : src/webmachine.app => ebin/webmachine.app
  • Loading branch information...
commit 3a64102b7257a2bd9192b1fd4d81c157e1535f23 2 parents efa4399 + e225e98
@beerriot beerriot authored
View
1  .hgtags
@@ -7,3 +7,4 @@
14365a12cb1463eba5850c33617480ba2be8e686 webmachine-1.4
616b08c30b4c29503063f23e9e6329c12feb3e90 webmachine-1.4
e75bdcf6eb529d44c686fbea20dd305e6f169544 webmachine-1.5
+4fec467ced13e0ef4c995d76c69d301e4eeda829 webmachine-1.6
View
2  ebin/webmachine.app
@@ -1,6 +1,6 @@
{application, webmachine,
[{description, "webmachine"},
- {vsn, "1.5"},
+ {vsn, "1.6"},
{modules, [
webmachine,
webmachine_app,
View
1  src/webmachine_decision_core.erl
@@ -26,6 +26,7 @@
-include("webmachine_logger.hrl").
handle_request(Resource, ReqState) ->
+ [erase(X) || X <- [decision, code, req_body, bytes_written, tmp_reqstate]],
put(resource, Resource),
put(reqstate, ReqState),
try
View
7 src/webmachine_request.erl
@@ -79,8 +79,8 @@
-include_lib("include/wm_reqstate.hrl").
-include_lib("include/wm_reqdata.hrl").
--define(WMVSN, "1.5.2").
--define(QUIP, "that tip is the fix").
+-define(WMVSN, "1.6").
+-define(QUIP, "eat around the stinger").
-define(IDLE_TIMEOUT, infinity).
trim_state() ->
@@ -379,11 +379,12 @@ read_whole_stream({Hunk,Next}, Acc0, MaxRecvBody, SizeAcc) ->
end.
recv_stream_body(PassedState=#wm_reqstate{reqdata=RD}, MaxHunkSize) ->
+ put(mochiweb_request_recv, true),
case get_header_value("expect") of
{"100-continue", _} ->
send(PassedState#wm_reqstate.socket,
[make_version(wrq:version(RD)),
- make_code(100), <<"\r\n">>]);
+ make_code(100), <<"\r\n\r\n">>]);
_Else ->
ok
end,
View
38 src/wrq.erl
@@ -32,6 +32,8 @@
% @type reqdata(). The opaque data type used for req/resp data structures.
-include_lib("include/wm_reqdata.hrl").
-include_lib("include/wm_reqstate.hrl").
+-include_lib("eunit/include/eunit.hrl").
+
create(Method,Version,RawPath,Headers) ->
create(#wm_reqdata{method=Method,version=Version,
@@ -42,7 +44,7 @@ create(Method,Version,RawPath,Headers) ->
req_qs=defined_in_create,
peer="defined_in_wm_req_srv_init",
req_body=not_fetched_yet,
- max_recv_body=(50*(1024*1024)),
+ max_recv_body=(1024*(1024*1024)),
app_root="defined_in_load_dispatch_data",
path_info=dict:new(),
path_tokens=defined_in_load_dispatch_data,
@@ -203,4 +205,36 @@ get_qs_value(Key, RD) when is_list(Key) -> % string
get_qs_value(Key, Default, RD) when is_list(Key) ->
proplists:get_value(Key, req_qs(RD), Default).
-
+make_wrq(Method, RawPath, Headers) ->
+ create(Method, {1,1}, RawPath, mochiweb_headers:from_list(Headers)).
+
+accessor_test() ->
+ R0 = make_wrq('GET', "/foo?a=1&b=2", [{"Cookie", "foo=bar"}]),
+ R = set_peer("127.0.0.1", R0),
+ ?assertEqual('GET', method(R)),
+ ?assertEqual({1,1}, version(R)),
+ ?assertEqual("/foo", path(R)),
+ ?assertEqual("/foo?a=1&b=2", raw_path(R)),
+ ?assertEqual([{"a", "1"}, {"b", "2"}], req_qs(R)),
+ ?assertEqual({"1", "2"}, {get_qs_value("a", R), get_qs_value("b", R)}),
+ ?assertEqual("3", get_qs_value("c", "3", R)),
+ ?assertEqual([{"foo", "bar"}], req_cookie(R)),
+ ?assertEqual("bar", get_cookie_value("foo", R)),
+ ?assertEqual("127.0.0.1", peer(R)).
+
+
+simple_dispatch_test() ->
+ R0 = make_wrq('GET', "/foo?a=1&b=2", [{"Cookie", "foo=bar"}]),
+ R1 = set_peer("127.0.0.1", R0),
+ {_, _, HostTokens, Port, PathTokens, Bindings, AppRoot, StringPath} =
+ webmachine_dispatcher:dispatch("127.0.0.1", "/foo",
+ [{["foo"], foo_resource, []}]),
+ R = load_dispatch_data(Bindings,
+ HostTokens,
+ Port,
+ PathTokens,
+ AppRoot,
+ StringPath,
+ R1),
+ ?assertEqual(".", app_root(R)),
+ ?assertEqual(80, port(R)).
Please sign in to comment.
Something went wrong with that request. Please try again.