diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_handler.erl | 1 | ||||
-rw-r--r-- | src/cowboy_middleware.erl | 1 | ||||
-rw-r--r-- | src/cowboy_protocol.erl | 8 | ||||
-rw-r--r-- | src/cowboy_router.erl | 8 | ||||
-rw-r--r-- | src/cowboy_spdy.erl | 8 |
5 files changed, 8 insertions, 18 deletions
diff --git a/src/cowboy_handler.erl b/src/cowboy_handler.erl index 5eb16b4..1e8261f 100644 --- a/src/cowboy_handler.erl +++ b/src/cowboy_handler.erl @@ -99,7 +99,6 @@ handler_init(Req, State, Handler, HandlerOpts) -> -> {ok, Req, Env} | {suspend, module(), atom(), any()} | {halt, Req} - | {error, cowboy:http_status(), Req} when Req::cowboy_req:req(), Env::cowboy_middleware:env(). upgrade_protocol(Req, #state{env=Env}, Handler, HandlerOpts, Module) -> diff --git a/src/cowboy_middleware.erl b/src/cowboy_middleware.erl index fa0f5bc..7ff947e 100644 --- a/src/cowboy_middleware.erl +++ b/src/cowboy_middleware.erl @@ -21,5 +21,4 @@ -> {ok, Req, Env} | {suspend, module(), atom(), [any()]} | {halt, Req} - | {error, cowboy:http_status(), Req} when Req::cowboy_req:req(), Env::env(). diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl index a5873ea..82f1f38 100644 --- a/src/cowboy_protocol.erl +++ b/src/cowboy_protocol.erl @@ -428,9 +428,7 @@ execute(Req, State, Env, [Middleware|Tail]) -> erlang:hibernate(?MODULE, resume, [State, Env, Tail, Module, Function, Args]); {halt, Req2} -> - next_request(Req2, State, ok); - {error, Code, Req2} -> - error_terminate(Code, Req2, State) + next_request(Req2, State, ok) end. -spec resume(#state{}, cowboy_middleware:env(), [module()], @@ -443,9 +441,7 @@ resume(State, Env, Tail, Module, Function, Args) -> erlang:hibernate(?MODULE, resume, [State, Env, Tail, Module2, Function2, Args2]); {halt, Req2} -> - next_request(Req2, State, ok); - {error, Code, Req2} -> - error_terminate(Code, Req2, State) + next_request(Req2, State, ok) end. -spec next_request(cowboy_req:req(), #state{}, any()) -> ok. diff --git a/src/cowboy_router.erl b/src/cowboy_router.erl index 3b71205..2e54151 100644 --- a/src/cowboy_router.erl +++ b/src/cowboy_router.erl @@ -157,7 +157,7 @@ compile_brackets_split(<< C, Rest/binary >>, Acc, N) -> compile_brackets_split(Rest, << Acc/binary, C >>, N). -spec execute(Req, Env) - -> {ok, Req, Env} | {error, 400 | 404, Req} + -> {ok, Req, Env} | {halt, Req} when Req::cowboy_req:req(), Env::cowboy_middleware:env(). execute(Req, Env) -> {_, Dispatch} = lists:keyfind(dispatch, 1, Env), @@ -168,11 +168,11 @@ execute(Req, Env) -> Req2 = cowboy_req:set_bindings(HostInfo, PathInfo, Bindings, Req), {ok, Req2, [{handler, Handler}, {handler_opts, HandlerOpts}|Env]}; {error, notfound, host} -> - {error, 400, Req}; + {halt, cowboy_req:reply(400, Req)}; {error, badrequest, path} -> - {error, 400, Req}; + {halt, cowboy_req:reply(400, Req)}; {error, notfound, path} -> - {error, 404, Req} + {halt, cowboy_req:reply(404, Req)} end. %% Internal. diff --git a/src/cowboy_spdy.erl b/src/cowboy_spdy.erl index 5b89c48..3057cca 100644 --- a/src/cowboy_spdy.erl +++ b/src/cowboy_spdy.erl @@ -407,9 +407,7 @@ execute(Req, Env, [Middleware|Tail]) -> erlang:hibernate(?MODULE, resume, [Env, Tail, Module, Function, Args]); {halt, Req2} -> - cowboy_req:ensure_response(Req2, 204); - {error, Status, Req2} -> - cowboy_req:reply(Status, Req2) + cowboy_req:ensure_response(Req2, 204) end. -spec resume(cowboy_middleware:env(), [module()], @@ -422,9 +420,7 @@ resume(Env, Tail, Module, Function, Args) -> erlang:hibernate(?MODULE, resume, [Env, Tail, Module2, Function2, Args2]); {halt, Req2} -> - cowboy_req:ensure_response(Req2, 204); - {error, Status, Req2} -> - cowboy_req:reply(Status, Req2) + cowboy_req:ensure_response(Req2, 204) end. %% Reply functions used by cowboy_req. |