Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix SSL Websocket support (Dan Willemsen)

fixed a case where a gen_tcp call was erroneously being used on an SSL
socket
  • Loading branch information...
commit c25ed57b0f56f9f313668b9f7e24ff8697842760 1 parent 40fac1e
@danw danw authored vinoski committed
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/yaws_websockets.erl
View
7 src/yaws_websockets.erl
@@ -58,7 +58,12 @@ handshake(Arg, ContentPid, SocketMode) ->
exit(normal).
handshake(ws_76, Arg, CliSock, WebSocketLocation, Origin, Protocol) ->
- {ok, Challenge} = gen_tcp:recv(CliSock, 8),
+ {ok, Challenge} = case CliSock of
+ {sslsocket, _, _} ->
+ ssl:recv(CliSock, 8);
+ _ ->
+ gen_tcp:recv(CliSock, 8)
+ end,
Key1 = secret_key("sec-websocket-key1", Arg#arg.headers),
Key2 = secret_key("sec-websocket-key2", Arg#arg.headers),
ChallengeResponse = challenge(Key1, Key2, binary_to_list(Challenge)),

0 comments on commit c25ed57

Please sign in to comment.
Something went wrong with that request. Please try again.