Skip to content

Commit

Permalink
Merge pull request #5 from datacompboy/master
Browse files Browse the repository at this point in the history
Fix handshake_continue/4 api change to handshake_continue/3.
  • Loading branch information
datacompboy committed Mar 26, 2014
2 parents 63a72ed + 81213d4 commit 23b3942
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/proto_ws.erl
Expand Up @@ -44,7 +44,6 @@
-callback handshake(#wstate{}) -> {'ok', iolist(), #wstate{}}. -callback handshake(#wstate{}) -> {'ok', iolist(), #wstate{}}.
-callback handshake_continue(WsCallback::fun(), -callback handshake_continue(WsCallback::fun(),
Acc::term(), Acc::term(),
Data::binary(),
State::wstate()) -> State::wstate()) ->
{term(), 'websocket_close'} | {term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} | {term(), 'websocket_close', binary()} |
Expand Down Expand Up @@ -167,7 +166,7 @@ check_headers(Headers, RequiredHeaders) ->
%% behaviour_info(callbacks) -> %% behaviour_info(callbacks) ->
%% [ %% [
%% {handshake, 1}, %% {handshake, 1},
%% {handshake_continue, 4}, %% {handshake_continue, 3},
%% {handle_data, 4}, %% {handle_data, 4},
%% {format_send, 2} %% {format_send, 2}
%% ]; %% ];
Expand Down
5 changes: 2 additions & 3 deletions src/proto_ws_draft-hixie-68.erl
Expand Up @@ -36,7 +36,7 @@
-vsn("0.9-dev"). -vsn("0.9-dev").


%% API %% API
-export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]). -export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).


-export([required_headers/0]). -export([required_headers/0]).


Expand Down Expand Up @@ -70,13 +70,12 @@ handshake(#wstate{socket_mode = SocketMode, force_ssl = WsForceSsl, origin = Ori


-spec handshake_continue(WsCallback::fun(), -spec handshake_continue(WsCallback::fun(),
Acc::term(), Acc::term(),
Data::binary(),
State::wstate()) -> State::wstate()) ->
{term(), 'websocket_close'} | {term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} | {term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} | {term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}. {term(), 'continue', binary(), wstate()}.
handshake_continue(_CB, _Acc0, _Data, _State) -> handshake_continue(_CB, _Acc0, _State) ->
erlang:error(should_not_happen). erlang:error(should_not_happen).


%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/proto_ws_draft-hixie-76.erl
Expand Up @@ -36,7 +36,7 @@
-vsn("0.9-dev"). -vsn("0.9-dev").


%% API %% API
-export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]). -export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).


-export([required_headers/0]). -export([required_headers/0]).


Expand All @@ -62,11 +62,11 @@ handshake(State) ->
%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
%% Description: Callback finalize handshake %% Description: Callback finalize handshake
%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
handshake_continue(CB, Acc0, Data, handshake_continue(CB, Acc0,
#wstate{socket_mode = SocketMode, force_ssl = WsForceSsl, headers = Headers, path = Path, origin = Origin, host = Host, buffer = Buffer} = State) -> #wstate{socket_mode = SocketMode, force_ssl = WsForceSsl, headers = Headers, path = Path, origin = Origin, host = Host, buffer = Buffer} = State) ->
Key1 = proto_ws_utility:header_get_value('Sec-WebSocket-Key1', Headers), Key1 = proto_ws_utility:header_get_value('Sec-WebSocket-Key1', Headers),
Key2 = proto_ws_utility:header_get_value('Sec-WebSocket-Key2', Headers), Key2 = proto_ws_utility:header_get_value('Sec-WebSocket-Key2', Headers),
case <<Buffer/binary, Data/binary>> of case <<Buffer/binary>> of
<<Body:8/binary, Rest/binary>> -> <<Body:8/binary, Rest/binary>> ->
WsMode = case SocketMode of WsMode = case SocketMode of
ssl -> "wss"; ssl -> "wss";
Expand Down
7 changes: 3 additions & 4 deletions src/proto_ws_draft-hybi-10.erl
Expand Up @@ -36,7 +36,7 @@
-vsn("0.9-dev"). -vsn("0.9-dev").


%% API %% API
-export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]). -export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).


-export([required_headers/0]). -export([required_headers/0]).


Expand Down Expand Up @@ -64,14 +64,13 @@ handshake(State) ->
%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
-spec handshake_continue(WsCallback::fun(), -spec handshake_continue(WsCallback::fun(),
Acc::term(), Acc::term(),
Data::binary(),
State::wstate()) -> State::wstate()) ->
{term(), 'websocket_close'} | {term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} | {term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} | {term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}. {term(), 'continue', binary(), wstate()}.
handshake_continue(WsCallback, Acc0, Data, State) -> handshake_continue(WsCallback, Acc0, State) ->
?HYBI_COMMON:handshake_continue(WsCallback, Acc0, Data, State). ?HYBI_COMMON:handshake_continue(WsCallback, Acc0, State).


%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
%% Description: Callback to handle incomed data. %% Description: Callback to handle incomed data.
Expand Down
5 changes: 2 additions & 3 deletions src/proto_ws_draft-hybi-10_17.erl
Expand Up @@ -36,7 +36,7 @@
-vsn("0.9-dev"). -vsn("0.9-dev").


%% API %% API
-export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]). -export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).


-include("../include/proto_ws.hrl"). -include("../include/proto_ws.hrl").


Expand Down Expand Up @@ -84,13 +84,12 @@ handshake(#wstate{headers = Headers} = State) ->
%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
-spec handshake_continue(WsCallback::fun(), -spec handshake_continue(WsCallback::fun(),
Acc::term(), Acc::term(),
Data::binary(),
State::wstate()) -> State::wstate()) ->
{term(), 'websocket_close'} | {term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} | {term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} | {term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}. {term(), 'continue', binary(), wstate()}.
handshake_continue(_CB, _Acc0, _Data, _State) -> handshake_continue(_CB, _Acc0, _State) ->
erlang:error(should_not_happen). erlang:error(should_not_happen).


%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
Expand Down
7 changes: 3 additions & 4 deletions src/proto_ws_draft-hybi-17.erl
Expand Up @@ -36,7 +36,7 @@
-vsn("0.9-dev"). -vsn("0.9-dev").


%% API %% API
-export([handshake/1, handshake_continue/4, handle_data/3, format_send/2]). -export([handshake/1, handshake_continue/3, handle_data/3, format_send/2]).


-export([required_headers/0]). -export([required_headers/0]).


Expand Down Expand Up @@ -64,14 +64,13 @@ handshake(State) ->
%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
-spec handshake_continue(WsCallback::fun(), -spec handshake_continue(WsCallback::fun(),
Acc::term(), Acc::term(),
Data::binary(),
State::wstate()) -> State::wstate()) ->
{term(), 'websocket_close'} | {term(), 'websocket_close'} |
{term(), 'websocket_close', binary()} | {term(), 'websocket_close', binary()} |
{term(), 'continue', wstate()} | {term(), 'continue', wstate()} |
{term(), 'continue', binary(), wstate()}. {term(), 'continue', binary(), wstate()}.
handshake_continue(WsCallback, Acc0, Data, State) -> handshake_continue(WsCallback, Acc0, State) ->
?HYBI_COMMON:handshake_continue(WsCallback, Acc0, Data, State). ?HYBI_COMMON:handshake_continue(WsCallback, Acc0, State).


%% ---------------------------------------------------------------------------------------------------------- %% ----------------------------------------------------------------------------------------------------------
%% Description: Callback to handle incomed data. %% Description: Callback to handle incomed data.
Expand Down

0 comments on commit 23b3942

Please sign in to comment.