aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-07-12 14:19:29 +0200
committerLoïc Hoguin <[email protected]>2014-07-12 14:19:29 +0200
commite2b5c21443a53b3bc98c90e41b8ccf08d5731db7 (patch)
treef6e85ceb5819a8cbfd36e7f8b77980680095cff5 /src
parentde4697690c5bee8349ff80f84b2393fd698c7d39 (diff)
downloadcowboy-e2b5c21443a53b3bc98c90e41b8ccf08d5731db7.tar.gz
cowboy-e2b5c21443a53b3bc98c90e41b8ccf08d5731db7.tar.bz2
cowboy-e2b5c21443a53b3bc98c90e41b8ccf08d5731db7.zip
Drop R15 support
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_clock.erl4
-rw-r--r--src/cowboy_req.erl4
-rw-r--r--src/cowboy_static.erl3
-rw-r--r--src/cowboy_websocket.erl9
4 files changed, 7 insertions, 13 deletions
diff --git a/src/cowboy_clock.erl b/src/cowboy_clock.erl
index 2de3470..37767e1 100644
--- a/src/cowboy_clock.erl
+++ b/src/cowboy_clock.erl
@@ -130,7 +130,7 @@ update_rfc1123(<< _:11/binary, Keep:6/binary, _/bits >>,
update_rfc1123(_, _, {Date = {Y, Mo, D}, {H, M, S}}) ->
Wday = calendar:day_of_the_week(Date),
<< (weekday(Wday))/binary, ", ", (pad_int(D))/binary, " ",
- (month(Mo))/binary, " ", (list_to_binary(integer_to_list(Y)))/binary,
+ (month(Mo))/binary, " ", (integer_to_binary(Y))/binary,
" ", (pad_int(H))/binary, $:, (pad_int(M))/binary,
$:, (pad_int(S))/binary, " GMT" >>.
@@ -139,7 +139,7 @@ update_rfc1123(_, _, {Date = {Y, Mo, D}, {H, M, S}}) ->
pad_int(X) when X < 10 ->
<< $0, ($0 + X) >>;
pad_int(X) ->
- list_to_binary(integer_to_list(X)).
+ integer_to_binary(X).
-spec weekday(1..7) -> <<_:24>>.
weekday(1) -> <<"Mon">>;
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index 86f06ec..cf9aa4a 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -276,7 +276,7 @@ host_url(Req=#http_req{transport=Transport, host=Host, port=Port}) ->
PortBin = case {TransportName, Port} of
{ssl, 443} -> <<>>;
{tcp, 80} -> <<>>;
- _ -> << ":", (list_to_binary(integer_to_list(Port)))/binary >>
+ _ -> << ":", (integer_to_binary(Port))/binary >>
end,
{<< "http", Secure/binary, "://", Host/binary, PortBin/binary >>, Req}.
@@ -634,7 +634,7 @@ body_decode(Req=#http_req{buffer=Data, body_state={stream, _,
body_decode_end(Req=#http_req{headers=Headers, p_headers=PHeaders},
TotalLength, Rest) ->
Headers2 = lists:keystore(<<"content-length">>, 1, Headers,
- {<<"content-length">>, list_to_binary(integer_to_list(TotalLength))}),
+ {<<"content-length">>, integer_to_binary(TotalLength)}),
%% At this point we just assume TEs were all decoded.
Headers3 = lists:keydelete(<<"transfer-encoding">>, 1, Headers2),
PHeaders2 = lists:keystore(<<"content-length">>, 1, PHeaders,
diff --git a/src/cowboy_static.erl b/src/cowboy_static.erl
index d10ee87..fae4568 100644
--- a/src/cowboy_static.erl
+++ b/src/cowboy_static.erl
@@ -264,8 +264,7 @@ generate_etag(Req, State={Path, {ok, #file_info{size=Size, mtime=Mtime}},
end.
generate_default_etag(Size, Mtime) ->
- {strong, list_to_binary(integer_to_list(
- erlang:phash2({Size, Mtime}, 16#ffffffff)))}.
+ {strong, integer_to_binary(erlang:phash2({Size, Mtime}, 16#ffffffff))}.
%% Return the time of last modification of the file.
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl
index d13441d..c0f94c4 100644
--- a/src/cowboy_websocket.erl
+++ b/src/cowboy_websocket.erl
@@ -17,10 +17,6 @@
-module(cowboy_websocket).
-behaviour(cowboy_sub_protocol).
-%% Ignore the deprecation warning for crypto:sha/1.
-%% @todo Remove when we support only R16B+.
--compile(nowarn_deprecated_function).
-
-export([upgrade/4]).
-export([handler_loop/4]).
@@ -74,7 +70,7 @@ upgrade(Req, Env, Handler, HandlerOpts) ->
receive
{cowboy_req, resp_sent} -> ok
after 0 ->
- cowboy_req:reply(400, Req),
+ _ = cowboy_req:reply(400, Req),
exit(normal)
end
end.
@@ -166,8 +162,7 @@ handler_init(State=#state{env=Env, transport=Transport,
websocket_handshake(State=#state{
transport=Transport, key=Key, deflate_frame=DeflateFrame},
Req, HandlerState) ->
- %% @todo Change into crypto:hash/2 for R17B+ or when supporting only R16B+.
- Challenge = base64:encode(crypto:sha(
+ Challenge = base64:encode(crypto:hash(sha,
<< Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)),
Extensions = case DeflateFrame of
false -> [];