Browse Source

Drop R15 support

Loïc Hoguin 11 years ago
parent
commit
e2b5c21443

+ 1 - 1
all.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 #!/bin/sh
 
 
 KERL_INSTALL_PATH=~/erlang
 KERL_INSTALL_PATH=~/erlang
-KERL_RELEASES="r15b01 r15b02 r15b03 r16b r16b01 r16b02 r16b03-1 17.0 17.1"
+KERL_RELEASES="r16b r16b01 r16b02 r16b03-1 17.0 17.1.2"
 
 
 make build-tests
 make build-tests
 
 

+ 1 - 1
doc/src/guide/introduction.ezdoc

@@ -32,7 +32,7 @@ guarantee that the experience will be safe and smooth. You are advised
 to perform the necessary testing and security audits prior to deploying
 to perform the necessary testing and security audits prior to deploying
 on other platforms.
 on other platforms.
 
 
-Cowboy is developed for Erlang R15B+.
+Cowboy is developed for Erlang/OTP R16B+.
 
 
 Cowboy may be compiled on earlier Erlang versions with small source code
 Cowboy may be compiled on earlier Erlang versions with small source code
 modifications but there is no guarantee that it will work as expected.
 modifications but there is no guarantee that it will work as expected.

+ 2 - 2
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}}) ->
 update_rfc1123(_, _, {Date = {Y, Mo, D}, {H, M, S}}) ->
 	Wday = calendar:day_of_the_week(Date),
 	Wday = calendar:day_of_the_week(Date),
 	<< (weekday(Wday))/binary, ", ", (pad_int(D))/binary, " ",
 	<< (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(H))/binary, $:, (pad_int(M))/binary,
 		$:, (pad_int(S))/binary, " GMT" >>.
 		$:, (pad_int(S))/binary, " GMT" >>.
 
 
@@ -139,7 +139,7 @@ update_rfc1123(_, _, {Date = {Y, Mo, D}, {H, M, S}}) ->
 pad_int(X) when X < 10 ->
 pad_int(X) when X < 10 ->
 	<< $0, ($0 + X) >>;
 	<< $0, ($0 + X) >>;
 pad_int(X) ->
 pad_int(X) ->
-	list_to_binary(integer_to_list(X)).
+	integer_to_binary(X).
 
 
 -spec weekday(1..7) -> <<_:24>>.
 -spec weekday(1..7) -> <<_:24>>.
 weekday(1) -> <<"Mon">>;
 weekday(1) -> <<"Mon">>;

+ 2 - 2
src/cowboy_req.erl

@@ -276,7 +276,7 @@ host_url(Req=#http_req{transport=Transport, host=Host, port=Port}) ->
 	PortBin = case {TransportName, Port} of
 	PortBin = case {TransportName, Port} of
 		{ssl, 443} -> <<>>;
 		{ssl, 443} -> <<>>;
 		{tcp, 80} -> <<>>;
 		{tcp, 80} -> <<>>;
-		_ -> << ":", (list_to_binary(integer_to_list(Port)))/binary >>
+		_ -> << ":", (integer_to_binary(Port))/binary >>
 	end,
 	end,
 	{<< "http", Secure/binary, "://", Host/binary, PortBin/binary >>, Req}.
 	{<< "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},
 body_decode_end(Req=#http_req{headers=Headers, p_headers=PHeaders},
 		TotalLength, Rest) ->
 		TotalLength, Rest) ->
 	Headers2 = lists:keystore(<<"content-length">>, 1, Headers,
 	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.
 	%% At this point we just assume TEs were all decoded.
 	Headers3 = lists:keydelete(<<"transfer-encoding">>, 1, Headers2),
 	Headers3 = lists:keydelete(<<"transfer-encoding">>, 1, Headers2),
 	PHeaders2 = lists:keystore(<<"content-length">>, 1, PHeaders,
 	PHeaders2 = lists:keystore(<<"content-length">>, 1, PHeaders,

+ 1 - 2
src/cowboy_static.erl

@@ -264,8 +264,7 @@ generate_etag(Req, State={Path, {ok, #file_info{size=Size, mtime=Mtime}},
 	end.
 	end.
 
 
 generate_default_etag(Size, Mtime) ->
 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.
 %% Return the time of last modification of the file.
 
 

+ 2 - 7
src/cowboy_websocket.erl

@@ -17,10 +17,6 @@
 -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).
-
 -export([upgrade/4]).
 -export([upgrade/4]).
 -export([handler_loop/4]).
 -export([handler_loop/4]).
 
 
@@ -74,7 +70,7 @@ upgrade(Req, Env, Handler, HandlerOpts) ->
 		receive
 		receive
 			{cowboy_req, resp_sent} -> ok
 			{cowboy_req, resp_sent} -> ok
 		after 0 ->
 		after 0 ->
-			cowboy_req:reply(400, Req),
+			_ = cowboy_req:reply(400, Req),
 			exit(normal)
 			exit(normal)
 		end
 		end
 	end.
 	end.
@@ -166,8 +162,7 @@ handler_init(State=#state{env=Env, transport=Transport,
 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:hash(sha,
 		<< Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)),
 		<< Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)),
 	Extensions = case DeflateFrame of
 	Extensions = case DeflateFrame of
 		false -> [];
 		false -> [];

+ 2 - 2
test/spdy_SUITE.erl

@@ -127,11 +127,11 @@ two_frames_one_packet(Config) ->
 			<<"/">>, <<"HTTP/1.1">>, [])
 			<<"/">>, <<"HTTP/1.1">>, [])
 	])),
 	])),
 	{Frame1, Rest1} = spdy_recv(Socket, Transport, <<>>),
 	{Frame1, Rest1} = spdy_recv(Socket, Transport, <<>>),
-	{syn_reply, 1, false, <<"200 OK">>, _, _} = cow_spdy:parse(Frame1, Zinf),
+	{syn_reply, _, false, <<"200 OK">>, _, _} = cow_spdy:parse(Frame1, Zinf),
 	{Frame2, Rest2} = spdy_recv(Socket, Transport, Rest1),
 	{Frame2, Rest2} = spdy_recv(Socket, Transport, Rest1),
 	{data, 1, true, _} = cow_spdy:parse(Frame2, Zinf),
 	{data, 1, true, _} = cow_spdy:parse(Frame2, Zinf),
 	{Frame3, Rest3} = spdy_recv(Socket, Transport, Rest2),
 	{Frame3, Rest3} = spdy_recv(Socket, Transport, Rest2),
-	{syn_reply, 3, false, <<"200 OK">>, _, _} = cow_spdy:parse(Frame3, Zinf),
+	{syn_reply, _, false, <<"200 OK">>, _, _} = cow_spdy:parse(Frame3, Zinf),
 	{Frame4, <<>>} = spdy_recv(Socket, Transport, Rest3),
 	{Frame4, <<>>} = spdy_recv(Socket, Transport, Rest3),
 	{data, 3, true, _} = cow_spdy:parse(Frame4, Zinf),
 	{data, 3, true, _} = cow_spdy:parse(Frame4, Zinf),
 	ok.
 	ok.