From 5e80e4baaca6ca866555a62db96b8e2623050521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 18 Mar 2011 01:52:46 +0100 Subject: Handler:init/2 should also return the Request in case it changed. --- README.md | 2 +- src/cowboy_http_protocol.erl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 876af0f..153d95c 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ handler could be written like this: -export([init/2, handle/2]). init(Req, Opts) -> - {ok, undefined}. + {ok, Req, undefined}. handle(Req, State) -> {reply, 200, [], "Hello World!"}. diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl index da10411..594699d 100644 --- a/src/cowboy_http_protocol.erl +++ b/src/cowboy_http_protocol.erl @@ -111,7 +111,7 @@ header(http_eoh, Req, State) -> -spec handler_init(Req::#http_req{}, State::#state{}) -> ok. handler_init(Req, State=#state{handler={Handler, Opts}}) -> case Handler:init(Req, Opts) of - {ok, HandlerState} -> + {ok, Req, HandlerState} -> handler_loop(HandlerState, Req, State) %% @todo {mode, active}; {upgrade_protocol, Module}; {error, Reason} end. -- cgit v1.2.3