mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Allow Handler:init/3 to request a protocol upgrade.
This commit is contained in:
parent
7888be00d2
commit
9fe8141d2a
1 changed files with 3 additions and 1 deletions
|
@ -135,7 +135,9 @@ handler_init(Req, State=#state{
|
||||||
case catch Handler:init({Transport:name(), http}, Req, Opts) of
|
case catch Handler:init({Transport:name(), http}, Req, Opts) of
|
||||||
{ok, Req, HandlerState} ->
|
{ok, Req, HandlerState} ->
|
||||||
handler_loop(HandlerState, Req, State);
|
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} ->
|
{'EXIT', _Reason} ->
|
||||||
error_terminate(500, State)
|
error_terminate(500, State)
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue