From ad9ab51648d16181960f4a4eeb27ea6948d35739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 31 Oct 2017 17:15:11 +0000 Subject: Add some todos --- src/cowboy_http2.erl | 1 + src/cowboy_stream_h.erl | 1 + src/cowboy_websocket.erl | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl index 663d33a..21f0aeb 100644 --- a/src/cowboy_http2.erl +++ b/src/cowboy_http2.erl @@ -774,6 +774,7 @@ stream_req_init(State=#state{ref=Ref, peer=Peer, sock=Sock, cert=Cert}, _ -> undefined end, + %% @todo If this fails to parse we want to gracefully handle the crash. {Host, Port} = cow_http_hd:parse_host(Authority), {Path, Qs} = cow_http:parse_fullpath(PathWithQs), Req = #{ diff --git a/src/cowboy_stream_h.erl b/src/cowboy_stream_h.erl index 8cd1457..8cbdbb0 100644 --- a/src/cowboy_stream_h.erl +++ b/src/cowboy_stream_h.erl @@ -232,6 +232,7 @@ request_process(Req, Env, Middlewares) -> _:Reason when OTP =:= "19" -> Stacktrace = erlang:get_stacktrace(), erlang:raise(exit, {Reason, Stacktrace}, Stacktrace); + %% @todo I don't think this clause is necessary. Class:Reason -> erlang:raise(Class, Reason, erlang:get_stacktrace()) end. diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index 549ef0d..3ec9f9a 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -172,6 +172,7 @@ websocket_handshake(State=#state{key=Key}, Req=#{pid := Pid, streamid := StreamID}, HandlerState, Env) -> Challenge = base64:encode(crypto:hash(sha, << Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)), + %% @todo We don't want date and server headers. Headers = cowboy_req:response_headers(#{ <<"connection">> => <<"Upgrade">>, <<"upgrade">> => <<"websocket">>, -- cgit v1.2.3