aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-03-22 23:03:43 +0100
committerLoïc Hoguin <[email protected]>2011-03-22 23:03:43 +0100
commit9fe8141d2a80b6e60a716bc4c318d8929195c808 (patch)
tree5efaee7a5fdfa9c68c283cc669d7d4ab68438b65 /src
parent7888be00d254677362ea2904c2c8cceeb1fc0663 (diff)
downloadcowboy-9fe8141d2a80b6e60a716bc4c318d8929195c808.tar.gz
cowboy-9fe8141d2a80b6e60a716bc4c318d8929195c808.tar.bz2
cowboy-9fe8141d2a80b6e60a716bc4c318d8929195c808.zip
Allow Handler:init/3 to request a protocol upgrade.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_http_protocol.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl
index d950373..d9fa04b 100644
--- a/src/cowboy_http_protocol.erl
+++ b/src/cowboy_http_protocol.erl
@@ -135,7 +135,9 @@ handler_init(Req, State=#state{
case catch Handler:init({Transport:name(), http}, Req, Opts) of
{ok, Req, HandlerState} ->
handler_loop(HandlerState, Req, State);
- %% @todo {upgrade, transport, Module}; {upgrade, protocol, Module}
+ %% @todo {upgrade, transport, Module}
+ {upgrade, protocol, Module} ->
+ Module:upgrade(Handler, Opts, Req);
{'EXIT', _Reason} ->
error_terminate(500, State)
end.