0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Ignore deprecation warning for crypto:sha/1 for now

We can change this call when we start supporting only R16B+,
which may happen when R17B is released or some time before.
This commit is contained in:
Loïc Hoguin 2013-06-20 15:38:25 +02:00
parent fdf2bc93f6
commit 11493a40f1

View file

@ -19,6 +19,10 @@
-module(cowboy_websocket). -module(cowboy_websocket).
-behaviour(cowboy_sub_protocol). -behaviour(cowboy_sub_protocol).
%% Ignore the deprecation warning for crypto:sha/1.
%% @todo Remove when we support only R16B+.
-compile({nowarn_deprecated_function, {crypto, sha, 1}}).
%% API. %% API.
-export([upgrade/4]). -export([upgrade/4]).
@ -176,6 +180,7 @@ upgrade_error(Req, Env) ->
websocket_handshake(State=#state{ websocket_handshake(State=#state{
transport=Transport, key=Key, deflate_frame=DeflateFrame}, transport=Transport, key=Key, deflate_frame=DeflateFrame},
Req, HandlerState) -> Req, HandlerState) ->
%% @todo Change into crypto:hash/2 for R17B+ or when supporting only R16B+.
Challenge = base64:encode(crypto:sha( Challenge = base64:encode(crypto:sha(
<< Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)), << Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)),
Extensions = case DeflateFrame of Extensions = case DeflateFrame of