Skip to content

Commit

Permalink
Update inets bridge to close properly /w ws hijack
Browse files Browse the repository at this point in the history
  • Loading branch information
choptastic committed Oct 30, 2014
1 parent 148486c commit 62ddd55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/inets_bridge_modules/inets_simple_bridge_anchor.erl
Expand Up @@ -12,8 +12,7 @@ do(Req) ->
Handler = simple_bridge_util:get_env(handler),
case simple_bridge_websocket:attempt_hijacking(Bridge, Handler) of
{hijacked, closed} ->
gen_tcp:close(Bridge:socket()),
exit(normal);
done;
{hijacked, Bridge2} ->
Bridge2:build_response();
spared ->
Expand Down
3 changes: 2 additions & 1 deletion src/simple_bridge_websocket.erl
Expand Up @@ -14,7 +14,7 @@
]).

%-compile(export_all).

-include("simple_bridge.hrl").
-include("crypto_compat.hrl").

-define(else, true).
Expand Down Expand Up @@ -48,6 +48,7 @@
-record(frame, {fin=1, rsv=0, opcode, masked=0, payload_len=0, mask_key, data = <<>>}).
-record(partial_data, {data = <<>>, message_frames=[]}).

-spec attempt_hijacking(bridge(), Handler :: atom()) -> spared | {hijacked, closed} | {hijacked, bridge()}.
attempt_hijacking(Bridge, Handler) ->
ProtocolVersion = sbw:protocol_version(Bridge),
UpgradeHeader = sbw:header_lower(upgrade, Bridge),
Expand Down

0 comments on commit 62ddd55

Please sign in to comment.