Browse Source

Allow Handler:init/3 to request a protocol upgrade.

Loïc Hoguin 14 years ago
parent
commit
9fe8141d2a
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/cowboy_http_protocol.erl

+ 3 - 1
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.