Browse Source

Add some todos

Loïc Hoguin 7 years ago
parent
commit
ad9ab51648
4 changed files with 6 additions and 1 deletions
  1. 1 0
      src/cowboy_http2.erl
  2. 1 0
      src/cowboy_stream_h.erl
  3. 1 0
      src/cowboy_websocket.erl
  4. 3 1
      test/static_handler_SUITE.erl

+ 1 - 0
src/cowboy_http2.erl

@@ -774,6 +774,7 @@ stream_req_init(State=#state{ref=Ref, peer=Peer, sock=Sock, cert=Cert},
 		_ ->
 		_ ->
 			undefined
 			undefined
 	end,
 	end,
+	%% @todo If this fails to parse we want to gracefully handle the crash.
 	{Host, Port} = cow_http_hd:parse_host(Authority),
 	{Host, Port} = cow_http_hd:parse_host(Authority),
 	{Path, Qs} = cow_http:parse_fullpath(PathWithQs),
 	{Path, Qs} = cow_http:parse_fullpath(PathWithQs),
 	Req = #{
 	Req = #{

+ 1 - 0
src/cowboy_stream_h.erl

@@ -232,6 +232,7 @@ request_process(Req, Env, Middlewares) ->
 		_:Reason when OTP =:= "19" ->
 		_:Reason when OTP =:= "19" ->
 			Stacktrace = erlang:get_stacktrace(),
 			Stacktrace = erlang:get_stacktrace(),
 			erlang:raise(exit, {Reason, Stacktrace}, Stacktrace);
 			erlang:raise(exit, {Reason, Stacktrace}, Stacktrace);
+		%% @todo I don't think this clause is necessary.
 		Class:Reason ->
 		Class:Reason ->
 			erlang:raise(Class, Reason, erlang:get_stacktrace())
 			erlang:raise(Class, Reason, erlang:get_stacktrace())
 	end.
 	end.

+ 1 - 0
src/cowboy_websocket.erl

@@ -172,6 +172,7 @@ websocket_handshake(State=#state{key=Key},
 		Req=#{pid := Pid, streamid := StreamID}, HandlerState, Env) ->
 		Req=#{pid := Pid, streamid := StreamID}, HandlerState, Env) ->
 	Challenge = base64:encode(crypto:hash(sha,
 	Challenge = base64:encode(crypto:hash(sha,
 		<< Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)),
 		<< Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)),
+	%% @todo We don't want date and server headers.
 	Headers = cowboy_req:response_headers(#{
 	Headers = cowboy_req:response_headers(#{
 		<<"connection">> => <<"Upgrade">>,
 		<<"connection">> => <<"Upgrade">>,
 		<<"upgrade">> => <<"websocket">>,
 		<<"upgrade">> => <<"websocket">>,

+ 3 - 1
test/static_handler_SUITE.erl

@@ -354,7 +354,9 @@ dir_error_directory_slash(Config) ->
 
 
 dir_error_doesnt_exist(Config) ->
 dir_error_doesnt_exist(Config) ->
 	doc("Try to get a file that does not exist."),
 	doc("Try to get a file that does not exist."),
-	{404, _, _} = do_get(config(prefix, Config) ++ "/not.found", Config),
+	%% @todo Check that the content-type header is removed.
+	{404, _Headers, _} = do_get(config(prefix, Config) ++ "/not.found", Config),
+%	false = lists:keyfind(<<"content-type">>, 1, Headers),
 	ok.
 	ok.
 
 
 dir_error_dot(Config) ->
 dir_error_dot(Config) ->