aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http2.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-12-13 12:40:00 +0100
committerLoïc Hoguin <[email protected]>2017-12-13 12:40:00 +0100
commit34473bc247138fb66d4a6739317340f4e7197625 (patch)
tree668ef651be486b5c459b901cfcbbdd1a08631574 /src/cowboy_http2.erl
parent576e2d21118829dbc018836c87dddb9037e9d3bf (diff)
downloadcowboy-34473bc247138fb66d4a6739317340f4e7197625.tar.gz
cowboy-34473bc247138fb66d4a6739317340f4e7197625.tar.bz2
cowboy-34473bc247138fb66d4a6739317340f4e7197625.zip
Fix Dialyzer warnings
Diffstat (limited to 'src/cowboy_http2.erl')
-rw-r--r--src/cowboy_http2.erl24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index 1382a46..54cd5c8 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -572,10 +572,11 @@ commands(State0, Stream0=#stream{local=nofin, te=TE0}, [{trailers, Trailers}|Tai
end,
commands(State, Stream, Tail);
%% Send a file.
-commands(State0, Stream0=#stream{local=nofin},
- [{sendfile, IsFin, Offset, Bytes, Path}|Tail]) ->
- {State, Stream} = send_data(State0, Stream0, IsFin, {sendfile, Offset, Bytes, Path}),
- commands(State, Stream, Tail);
+%% @todo Add the sendfile command.
+%commands(State0, Stream0=#stream{local=nofin},
+% [{sendfile, IsFin, Offset, Bytes, Path}|Tail]) ->
+% {State, Stream} = send_data(State0, Stream0, IsFin, {sendfile, Offset, Bytes, Path}),
+% commands(State, Stream, Tail);
%% @todo sendfile when local!=nofin
%% Send a push promise.
%%
@@ -843,10 +844,10 @@ stream_pseudo_headers_init(State, StreamID, IsFin, Headers0) ->
case pseudo_headers(Headers0, #{}) of
%% @todo Add clause for CONNECT requests (no scheme/path).
{ok, PseudoHeaders=#{method := <<"CONNECT">>}, _} ->
- stream_early_error(State, StreamID, 501, PseudoHeaders,
+ stream_early_error(State, StreamID, IsFin, 501, PseudoHeaders,
'The CONNECT method is currently not implemented. (RFC7231 4.3.6)');
{ok, PseudoHeaders=#{method := <<"TRACE">>}, _} ->
- stream_early_error(State, StreamID, 501, PseudoHeaders,
+ stream_early_error(State, StreamID, IsFin, 501, PseudoHeaders,
'The TRACE method is currently not implemented. (RFC7231 4.3.8)');
{ok, PseudoHeaders=#{method := _, scheme := _, authority := _, path := _}, Headers} ->
stream_regular_headers_init(State, StreamID, IsFin, Headers, PseudoHeaders);
@@ -983,8 +984,11 @@ stream_malformed(State=#state{socket=Socket, transport=Transport}, StreamID, _)
Transport:send(Socket, cow_http2:rst_stream(StreamID, protocol_error)),
State.
-stream_early_error(State0=#state{ref=Ref, opts=Opts, peer=Peer, streams=Streams},
- StreamID, StatusCode0, #{method := Method}, HumanReadable) ->
+stream_early_error(State0=#state{ref=Ref, opts=Opts, peer=Peer,
+ local_settings=#{initial_window_size := RemoteWindow},
+ remote_settings=#{initial_window_size := LocalWindow},
+ streams=Streams}, StreamID, IsFin, StatusCode0,
+ #{method := Method}, HumanReadable) ->
%% We automatically terminate the stream but it is not an error
%% per se (at least not in the first implementation).
Reason = {stream_error, no_error, HumanReadable},
@@ -997,7 +1001,9 @@ stream_early_error(State0=#state{ref=Ref, opts=Opts, peer=Peer, streams=Streams}
},
Resp = {response, StatusCode0, RespHeaders0=#{<<"content-length">> => <<"0">>}, <<>>},
%% We need a stream to talk to the send_* functions.
- Stream0 = #stream{id=StreamID, method=Method},
+ Stream0 = #stream{id=StreamID, state=flush, method=Method,
+ remote=IsFin, local=idle,
+ local_window=LocalWindow, remote_window=RemoteWindow},
try cowboy_stream:early_error(StreamID, Reason, PartialReq, Resp, Opts) of
{response, StatusCode, RespHeaders, RespBody} ->
case send_response(State0, Stream0, StatusCode, RespHeaders, RespBody) of