0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Remove a bunch of todos

This commit is contained in:
Loïc Hoguin 2018-04-30 18:39:27 +02:00
parent 5d5f3f8461
commit 28d3515d71
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
3 changed files with 3 additions and 16 deletions

View file

@ -52,8 +52,6 @@ unless strictly necessary. If adding new fields, make sure
to namespace the field names so that no conflict can occur to namespace the field names so that no conflict can occur
with future Cowboy updates or third party projects. with future Cowboy updates or third party projects.
// @todo There are currently no tests for direct access.
=== Introduction to the cowboy_req interface === Introduction to the cowboy_req interface
// @todo Link to cowboy_req manual // @todo Link to cowboy_req manual

View file

@ -335,7 +335,6 @@ Sent when the request process pushes a resource to the client.
Same as the xref:switch_protocol_command[switch_protocol command]. Same as the xref:switch_protocol_command[switch_protocol command].
// @todo Not done for HTTP/2 yet.
Sent when switching to the HTTP/2 or Websocket protocol. Sent when switching to the HTTP/2 or Websocket protocol.
== Exports == Exports

View file

@ -435,7 +435,6 @@ frame(State=#state{client_streamid=LastStreamID, streams=Streams},
end; end;
%% Single HEADERS frame headers block. %% Single HEADERS frame headers block.
frame(State, {headers, StreamID, IsFin, head_fin, HeaderBlock}) -> frame(State, {headers, StreamID, IsFin, head_fin, HeaderBlock}) ->
%% @todo We probably need to validate StreamID here and in 4 next clauses.
stream_decode_init(State, StreamID, IsFin, HeaderBlock); stream_decode_init(State, StreamID, IsFin, HeaderBlock);
%% HEADERS frame starting a headers block. Enter continuation mode. %% HEADERS frame starting a headers block. Enter continuation mode.
frame(State, {headers, StreamID, IsFin, head_nofin, HeaderBlockFragment}) -> frame(State, {headers, StreamID, IsFin, head_nofin, HeaderBlockFragment}) ->
@ -452,7 +451,6 @@ frame(State, {headers, StreamID, IsFin, head_nofin,
State#state{parse_state={continuation, StreamID, IsFin, HeaderBlockFragment}}; State#state{parse_state={continuation, StreamID, IsFin, HeaderBlockFragment}};
%% PRIORITY frame. %% PRIORITY frame.
frame(State, {priority, _StreamID, _IsExclusive, _DepStreamID, _Weight}) -> frame(State, {priority, _StreamID, _IsExclusive, _DepStreamID, _Weight}) ->
%% @todo Validate StreamID?
%% @todo Handle priority. %% @todo Handle priority.
State; State;
%% RST_STREAM frame. %% RST_STREAM frame.
@ -653,6 +651,9 @@ info(State=#state{client_streamid=LastStreamID, streams=Streams}, StreamID, Msg)
State State
end. end.
%% @todo Kill the stream if it tries to send a response, headers,
%% data or push promise when the stream is closed or half-closed.
commands(State, Stream, []) -> commands(State, Stream, []) ->
after_commands(State, Stream); after_commands(State, Stream);
%% Error responses are sent only if a response wasn't sent already. %% Error responses are sent only if a response wasn't sent already.
@ -665,15 +666,10 @@ commands(State0, Stream=#stream{local=idle}, [{inform, StatusCode, Headers}|Tail
State = send_headers(State0, Stream, StatusCode, Headers, nofin), State = send_headers(State0, Stream, StatusCode, Headers, nofin),
commands(State, Stream, Tail); commands(State, Stream, Tail);
%% Send response headers. %% Send response headers.
%%
%% @todo Kill the stream if it sent a response when one has already been sent.
%% @todo Keep IsFin in the state.
%% @todo Same two things above apply to DATA, possibly promise too.
commands(State0, Stream0=#stream{local=idle}, commands(State0, Stream0=#stream{local=idle},
[{response, StatusCode, Headers, Body}|Tail]) -> [{response, StatusCode, Headers, Body}|Tail]) ->
{State, Stream} = send_response(State0, Stream0, StatusCode, Headers, Body), {State, Stream} = send_response(State0, Stream0, StatusCode, Headers, Body),
commands(State, Stream, Tail); commands(State, Stream, Tail);
%% @todo response when local!=idle
%% Send response headers. %% Send response headers.
commands(State0, Stream=#stream{method=Method, local=idle}, commands(State0, Stream=#stream{method=Method, local=idle},
[{headers, StatusCode, Headers}|Tail]) -> [{headers, StatusCode, Headers}|Tail]) ->
@ -683,12 +679,10 @@ commands(State0, Stream=#stream{method=Method, local=idle},
end, end,
State = send_headers(State0, Stream, StatusCode, Headers, IsFin), State = send_headers(State0, Stream, StatusCode, Headers, IsFin),
commands(State, Stream#stream{local=IsFin}, Tail); commands(State, Stream#stream{local=IsFin}, Tail);
%% @todo headers when local!=idle
%% Send a response body chunk. %% Send a response body chunk.
commands(State0, Stream0=#stream{local=nofin}, [{data, IsFin, Data}|Tail]) -> commands(State0, Stream0=#stream{local=nofin}, [{data, IsFin, Data}|Tail]) ->
{State, Stream} = send_data(State0, Stream0, IsFin, Data), {State, Stream} = send_data(State0, Stream0, IsFin, Data),
commands(State, Stream, Tail); commands(State, Stream, Tail);
%% @todo data when local!=nofin
%% Send trailers. %% Send trailers.
commands(State0, Stream0=#stream{local=nofin, te=TE0}, [{trailers, Trailers}|Tail]) -> commands(State0, Stream0=#stream{local=nofin, te=TE0}, [{trailers, Trailers}|Tail]) ->
%% We only accept TE headers containing exactly "trailers" (RFC7540 8.1.2.1). %% We only accept TE headers containing exactly "trailers" (RFC7540 8.1.2.1).
@ -712,7 +706,6 @@ commands(State0, Stream0=#stream{local=nofin, te=TE0}, [{trailers, Trailers}|Tai
% [{sendfile, IsFin, Offset, Bytes, Path}|Tail]) -> % [{sendfile, IsFin, Offset, Bytes, Path}|Tail]) ->
% {State, Stream} = send_data(State0, Stream0, IsFin, {sendfile, Offset, Bytes, Path}), % {State, Stream} = send_data(State0, Stream0, IsFin, {sendfile, Offset, Bytes, Path}),
% commands(State, Stream, Tail); % commands(State, Stream, Tail);
%% @todo sendfile when local!=nofin
%% Send a push promise. %% Send a push promise.
%% %%
%% @todo We need to keep track of what promises we made so that we don't %% @todo We need to keep track of what promises we made so that we don't
@ -858,8 +851,6 @@ resume_streams(State0, [Stream0|Tail], Acc) ->
send_data(State, Stream=#stream{local=Local, local_buffer_size=0, local_trailers=Trailers}) send_data(State, Stream=#stream{local=Local, local_buffer_size=0, local_trailers=Trailers})
when (Trailers =/= undefined) andalso ((Local =:= idle) orelse (Local =:= nofin)) -> when (Trailers =/= undefined) andalso ((Local =:= idle) orelse (Local =:= nofin)) ->
send_trailers(State, Stream#stream{local_trailers=undefined}, Trailers); send_trailers(State, Stream#stream{local_trailers=undefined}, Trailers);
%% @todo We might want to print an error if local=fin.
%%
%% @todo It's possible that the stream terminates. We must remove it. %% @todo It's possible that the stream terminates. We must remove it.
send_data(State=#state{local_window=ConnWindow}, send_data(State=#state{local_window=ConnWindow},
Stream=#stream{local=IsFin, local_window=StreamWindow, local_buffer_size=BufferSize}) Stream=#stream{local=IsFin, local_window=StreamWindow, local_buffer_size=BufferSize})
@ -883,7 +874,6 @@ send_data(State, Stream=#stream{local_buffer_size=0}, fin, {trailers, Trailers},
send_data(State, Stream, fin, {trailers, Trailers}, _) -> send_data(State, Stream, fin, {trailers, Trailers}, _) ->
{State, Stream#stream{local_trailers=Trailers}}; {State, Stream#stream{local_trailers=Trailers}};
%% Send data immediately if we can, buffer otherwise. %% Send data immediately if we can, buffer otherwise.
%% @todo We might want to print an error if local=fin.
send_data(State=#state{local_window=ConnWindow}, send_data(State=#state{local_window=ConnWindow},
Stream=#stream{local_window=StreamWindow}, IsFin, Data, In) Stream=#stream{local_window=StreamWindow}, IsFin, Data, In)
when ConnWindow =< 0; StreamWindow =< 0 -> when ConnWindow =< 0; StreamWindow =< 0 ->