aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-08-10 11:52:41 +0200
committerLoïc Hoguin <[email protected]>2016-08-10 11:52:41 +0200
commit3a057683afc79c8f26b37ff12507032df201fc7e (patch)
tree6a6e60ec917a52c1e808abe9184bac4a2389ad14 /src/cowboy_http.erl
parentae0dd616737d8e1116de4a04be0bc84188997eb0 (diff)
downloadcowboy-3a057683afc79c8f26b37ff12507032df201fc7e.tar.gz
cowboy-3a057683afc79c8f26b37ff12507032df201fc7e.tar.bz2
cowboy-3a057683afc79c8f26b37ff12507032df201fc7e.zip
Add a lot of todos
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index 5cb00ad..279b11a 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -270,6 +270,7 @@ after_parse({request, Req=#{streamid := StreamID, headers := Headers, version :=
error_logger:error_msg("Exception occurred in ~s:init(~p, ~p, ~p) "
"with reason ~p:~p.",
[Handler, StreamID, Req, Opts, Class, Reason]),
+ %% @todo Bad value returned here. Crashes.
ok
%% @todo Status code.
% stream_reset(State, StreamID, {internal_error, {Class, Reason},
@@ -287,6 +288,7 @@ after_parse({data, StreamID, IsFin, Data, State=#state{handler=Handler,
catch Class:Reason ->
error_logger:error_msg("Exception occurred in ~s:data(~p, ~p, ~p, ~p) with reason ~p:~p.",
[Handler, StreamID, IsFin, Data, StreamState0, Class, Reason]),
+ %% @todo Bad value returned here. Crashes.
ok
%% @todo
% stream_reset(State, StreamID, {internal_error, {Class, Reason},
@@ -618,6 +620,9 @@ 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.
+
path => Path,
qs => Qs,
version => Version,
@@ -735,6 +740,11 @@ parse_body(Buffer, State=#state{in_streamid=StreamID, in_state=
%% Message handling.
+%% @todo There is a difference in behavior between HTTP/1.1 and HTTP/2
+%% when an error or crash occurs after sending a 500 response. In HTTP/2
+%% the error will be printed, in HTTP/1.1 the error will be ignored.
+%% This is due to HTTP/1.1 disabling streams differently after both
+%% requests and responses have been sent.
down(State=#state{children=Children0}, Pid, Msg) ->
case lists:keytake(Pid, 1, Children0) of
{value, {_, undefined, _}, Children} ->
@@ -837,8 +847,12 @@ commands(State0=#state{socket=Socket, transport=Transport, streams=Streams}, Str
%% Send a response body chunk.
%%
%% @todo WINDOW_UPDATE stuff require us to buffer some data.
+%% @todo We probably want to allow Data to be the {sendfile, ...} tuple also.
commands(State=#state{socket=Socket, transport=Transport, streams=Streams}, StreamID,
[{data, IsFin, Data}|Tail]) ->
+
+ %% @todo We need to kill the stream if it tries to send data before headers.
+
%% @todo Same as above.
case lists:keyfind(StreamID, #stream.id, Streams) of
#stream{version='HTTP/1.1'} ->
@@ -879,6 +893,9 @@ commands(State0=#state{ref=Ref, parent=Parent, socket=Socket, transport=Transpor
commands(State, StreamID, [stop|Tail]) ->
%% @todo Do we want to run the commands after a stop?
% commands(stream_terminate(State, StreamID, stop), StreamID, Tail).
+
+ %% @todo I think that's where we need to terminate streams.
+
maybe_terminate(State, StreamID, Tail, fin);
%% HTTP/1.1 does not support push; ignore.
commands(State, StreamID, [{push, _, _, _, _, _, _, _}|Tail]) ->