Anonymous avatar Anonymous committed eb6bd65

one point oh!

Comments (0)

Files changed (6)

demo/src/webmachine_demo_sup.erl

     Ip = case os:getenv("WEBMACHINE_IP") of false -> "0.0.0.0"; Any -> Any end,
     WebConfig = [
 		 {ip, Ip},
+                 {backlog, 1000},
 		 {port, 8000},
                  {log_dir, "priv/log"},
 		 {dispatch, dispatch_map()}],

src/webmachine.app

 {application, webmachine,
  [{description, "webmachine"},
-  {vsn, "0.97"},
+  {vsn, "0.98"},
   {modules, [
     webmachine,
     webmachine_app,

src/webmachine_dispatcher.erl

 %%                                      {stop, Reason, Reply, State} |
 %%                                      {stop, Reason, State}
 %% Description: Handling call messages
-handle_call({dispatch, Req}, _From, State) ->
-    DispatchData = binding_dispatch(State#state.dispatchlist, Req),
-    {reply, DispatchData, State};
+handle_call({dispatch, Req}, From, State) ->
+    spawn(fun() -> binding_dispatch(State#state.dispatchlist, Req, From) end),
+    {noreply, State};
 handle_call(get_error_handler, _From, State) ->
     {reply, State#state.error_handler, State};
 handle_call(get_dispatch_list, _From, State) ->
 reconstitute(UnmatchedTokens) ->
     string:join(UnmatchedTokens, [?SEPARATOR]).
 
-binding_dispatch(DispatchList, Req) ->
+binding_dispatch(DispatchList, Req, Client) ->
     PathAsString = Req:path(),
     Path = string:tokens(PathAsString, [?SEPARATOR]),
     % URIs that end with a trailing slash are implicitly one token
 		     true -> 1;
 		     _ -> 0
 		 end,
-    try_binding(DispatchList, Path, ExtraDepth).
+    gen_server:reply(Client, try_binding(DispatchList, Path, ExtraDepth)).
 
 calculate_app_root(1) ->
     ".";

src/webmachine_request_srv.erl

 -include("webmachine_logger.hrl").
 -include_lib("include/wm_reqdata.hrl").
 
--define(WMVSN, "0.97").
+-define(WMVSN, "0.98").
 -define(QUIP, "Better than a saber saw.").
 
 % Maximum recv_body() length of 50MB
 send(Socket, Data) ->
     case gen_tcp:send(Socket, Data) of
 	ok -> ok;
+	{error,closed} -> ok;
 	_ -> exit(normal)
     end.
 

src/webmachine_sup.erl

     [supervisor:start_child(?MODULE, Spec) || Spec <- Specs],
     ok.
 
-
-
 %% @spec init([]) -> SupervisorTree
 %% @doc supervisor callback.
 init([]) ->
 -export([path_info/2,get_req_header/2,do_redirect/2,fresh_resp_headers/2,
          get_resp_header/2,set_resp_header/3,set_resp_headers/2,
          set_disp_path/2,set_req_body/2,set_resp_body/2,set_response_code/2,
-         merge_resp_headers/2,remove_resp_header/2,append_to_response_body/2,
+         merge_resp_headers/2,remove_resp_header/2,
+         append_to_resp_body/2,append_to_response_body/2,
          get_cookie_value/2,get_qs_value/2,get_qs_value/3,set_peer/2]).
 
 -include_lib("include/wm_reqdata.hrl").
     NewHdrs = lists:foldl(F, RespH, Hdrs),
     RD#wm_reqdata{resp_headers=NewHdrs}.
 
+append_to_resp_body(Data, RD) -> append_to_response_body(Data, RD).
 append_to_response_body(Data, RD=#wm_reqdata{resp_body=RespB}) ->
     case is_binary(Data) of
 	true ->
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.