mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Drop R15 support
This commit is contained in:
parent
de4697690c
commit
e2b5c21443
7 changed files with 11 additions and 17 deletions
2
all.sh
2
all.sh
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -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
|
||||
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
|
||||
modifications but there is no guarantee that it will work as expected.
|
||||
|
|
|
@ -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">>;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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 -> [];
|
||||
|
|
|
@ -127,11 +127,11 @@ two_frames_one_packet(Config) ->
|
|||
<<"/">>, <<"HTTP/1.1">>, [])
|
||||
])),
|
||||
{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),
|
||||
{data, 1, true, _} = cow_spdy:parse(Frame2, Zinf),
|
||||
{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),
|
||||
{data, 3, true, _} = cow_spdy:parse(Frame4, Zinf),
|
||||
ok.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue