From 80f8cda7ff8fe6a575b4c2eaedd8451acf4fcef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 5 Feb 2017 20:45:36 +0100 Subject: Remove or fix a small number of todo comments One had the todo text fixed, another had the task to do done. --- src/cowboy_http.erl | 19 ++----------------- src/cowboy_http2.erl | 9 +-------- src/cowboy_req.erl | 3 +-- src/cowboy_stream_h.erl | 1 - 4 files changed, 4 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl index 9716a63..8615c85 100644 --- a/src/cowboy_http.erl +++ b/src/cowboy_http.erl @@ -111,9 +111,6 @@ %% Children which are in the process of shutting down. children = [] :: [{pid(), cowboy_stream:streamid(), timeout()}] - - %% @todo Automatic compression. (compress option?) - %% @todo onresponse? Equivalent using streams. }). -include_lib("cowlib/include/cow_inline.hrl"). @@ -246,8 +243,6 @@ parse(Buffer, State=#state{in_state=#ps_body{}}) -> %% @todo We do not want to get the body automatically if the request doesn't ask for it. %% We may want to get bodies that are below a threshold without waiting, and buffer them %% until the request asks, though. - - %% @todo Transfer-decoding must be done here. after_parse(parse_body(Buffer, State)). %% @todo Don't parse if body is finished but request isn't. Let's not parallelize for now. @@ -415,7 +410,6 @@ skip_uri_fragment(<< C, Rest/bits >>, State, M, P, Q) -> _ -> skip_uri_fragment(Rest, State, M, P, Q) end. -%% @todo Calls to parse_header should update the state. parse_version(<< "HTTP/1.1\r\n", Rest/bits >>, State, M, P, Q) -> parse_headers(Rest, State, M, P, Q, 'HTTP/1.1'); parse_version(<< "HTTP/1.0\r\n", Rest/bits >>, State, M, P, Q) -> @@ -431,7 +425,6 @@ parse_version(_, State, _, _, _) -> 'Unsupported HTTP version. (RFC7230 2.6)'}). parse_headers(Rest, State, M, P, Q, V) -> - %% @todo Figure out the parse states. parse_header(Rest, State#state{in_state=#ps_header{ method=M, path=P, qs=Q, version=V}}, #{}). @@ -606,21 +599,15 @@ request(Buffer, State0=#state{ref=Ref, transport=Transport, peer=Peer, in_stream scheme => Scheme, host => Host, port => Port, - -%% @todo So the path component needs to be normalized. - + %% @todo The path component needs to be normalized. path => Path, qs => Qs, version => Version, %% We are transparently taking care of transfer-encodings so %% the user code has no need to know about it. headers => maps:remove(<<"transfer-encoding">>, Headers), - has_body => HasBody, body_length => BodyLength - %% @todo multipart? keep state separate - - %% meta values (cowboy_websocket, cowboy_rest) }, case is_http2_upgrade(Headers, Version) of false -> @@ -679,14 +666,12 @@ http2_upgrade(State=#state{parent=Parent, ref=Ref, socket=Socket, transport=Tran %% However if the client sent a body, we need to read the body in full %% and if we can't do that, return a 413 response. Some options are in order. %% Always half-closed stream coming from this side. - try cow_http_hd:parse_http2_settings(HTTP2Settings) of Settings -> Transport:send(Socket, cow_http:response(101, 'HTTP/1.1', maps:to_list(#{ <<"connection">> => <<"Upgrade">>, <<"upgrade">> => <<"h2c">> }))), - %% @todo Possibly redirect the request if it was https. _ = cancel_request_timeout(State), cowboy_http2:init(Parent, Ref, Socket, Transport, Opts, Peer, Buffer, Settings, Req) @@ -1030,7 +1015,7 @@ error_terminate(StatusCode, State=#state{socket=Socket, transport=Transport}, Re -spec terminate(_, _) -> no_return(). terminate(_State, _Reason) -> - exit(normal). %% @todo + exit(normal). %% @todo We probably don't want to exit normal on errors. %% System callbacks. diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl index e816c93..eed2d6b 100644 --- a/src/cowboy_http2.erl +++ b/src/cowboy_http2.erl @@ -36,9 +36,6 @@ -type stream() :: #stream{}. -%% @todo priority: if we receive a message for a stream, do a selective receive -%% to get all messages in the mailbox and prioritize them. (later) - -record(state, { parent = undefined :: pid(), ref :: ranch:ref(), @@ -569,7 +566,7 @@ stream_init(State0=#state{ref=Ref, socket=Socket, transport=Transport, peer=Peer cow_http_hd:parse_content_length(BinLength) catch _:_ -> terminate(State0, {stream_error, StreamID, protocol_error, - ''}) %% @todo + 'The content-length header is invalid. (RFC7230 3.3.2)'}) %% @todo Err should terminate here... end, Length; @@ -591,12 +588,8 @@ stream_init(State0=#state{ref=Ref, socket=Socket, transport=Transport, peer=Peer qs => Qs, version => 'HTTP/2', headers => Headers, - has_body => IsFin =:= nofin, body_length => BodyLength - %% @todo multipart? keep state separate - - %% meta values (cowboy_websocket, cowboy_rest) }, stream_handler_init(State, StreamID, IsFin, Req); {_, DecodeState} -> diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index ac9054b..1d00aa2 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -65,7 +65,6 @@ -export([set_resp_header/3]). -export([set_resp_headers/2]). -export([has_resp_header/2]). -%% @todo resp_header -export([delete_resp_header/2]). -export([set_resp_body/2]). %% @todo set_resp_body/3 with a ContentType or even Headers argument, to set content headers. @@ -75,7 +74,7 @@ -export([reply/4]). -export([stream_reply/2]). -export([stream_reply/3]). -%% @todo stream_reply/2 (nofin) +%% @todo stream_body/2 (nofin) -export([stream_body/3]). %% @todo stream_event/2,3 -export([push/3]). diff --git a/src/cowboy_stream_h.erl b/src/cowboy_stream_h.erl index 8278b21..cc2f5c0 100644 --- a/src/cowboy_stream_h.erl +++ b/src/cowboy_stream_h.erl @@ -116,7 +116,6 @@ info(_StreamID, SwitchProtocol = {switch_protocol, _, _, _}, State) -> {[SwitchProtocol], State}; %% Stray message. info(_StreamID, _Info, State) -> - %% @todo Error report. %% @todo Cleanup if no reply was sent when stream ends. {[], State}. -- cgit v1.2.3