aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-10-28 11:42:18 +0100
committerLoïc Hoguin <[email protected]>2018-10-28 11:42:18 +0100
commit266178b6bc1c2c0b07f62175c55e949a397ca7d6 (patch)
tree7202d27d93840d9dcea1100be3924bad95ee68ae /src
parentd4129e63051efb29d7955e7913571671471090a5 (diff)
downloadcowboy-266178b6bc1c2c0b07f62175c55e949a397ca7d6.tar.gz
cowboy-266178b6bc1c2c0b07f62175c55e949a397ca7d6.tar.bz2
cowboy-266178b6bc1c2c0b07f62175c55e949a397ca7d6.zip
Remove an unnecessary function
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_http2.erl19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl
index c7176eb..6a82a93 100644
--- a/src/cowboy_http2.erl
+++ b/src/cowboy_http2.erl
@@ -293,8 +293,8 @@ headers_frame(State=#state{ref=Ref, peer=Peer, sock=Sock, cert=Cert},
Port = ensure_port(Scheme, Port0),
try cow_http:parse_fullpath(PathWithQs) of
{<<>>, _} ->
- malformed_request(State, StreamID,
- 'The path component must not be empty. (RFC7540 8.1.2.3)');
+ stream_reset(State, StreamID, {stream_error, protocol_error,
+ 'The path component must not be empty. (RFC7540 8.1.2.3)'});
{Path, Qs} ->
Req0 = #{
ref => Ref,
@@ -323,12 +323,12 @@ headers_frame(State=#state{ref=Ref, peer=Peer, sock=Sock, cert=Cert},
end,
headers_frame(State, StreamID, Req)
catch _:_ ->
- malformed_request(State, StreamID,
- 'The :path pseudo-header is invalid. (RFC7540 8.1.2.3)')
+ stream_reset(State, StreamID, {stream_error, protocol_error,
+ 'The :path pseudo-header is invalid. (RFC7540 8.1.2.3)'})
end
catch _:_ ->
- malformed_request(State, StreamID,
- 'The :authority pseudo-header is invalid. (RFC7540 8.1.2.3)')
+ stream_reset(State, StreamID, {stream_error, protocol_error,
+ 'The :authority pseudo-header is invalid. (RFC7540 8.1.2.3)'})
end.
ensure_port(<<"http">>, undefined) -> 80;
@@ -351,13 +351,6 @@ headers_to_map([{Name, Value}|Tail], Acc0) ->
end,
headers_to_map(Tail, Acc).
-%% @todo Probably not a very useful function, just use stream_reset.
-malformed_request(State=#state{socket=Socket, transport=Transport,
- http2_machine=HTTP2Machine0}, StreamID, _) ->
- Transport:send(Socket, cow_http2:rst_stream(StreamID, protocol_error)),
- {ok, HTTP2Machine} = cow_http2_machine:reset_stream(StreamID, HTTP2Machine0),
- State#state{http2_machine=HTTP2Machine}.
-
headers_frame(State=#state{opts=Opts, streams=Streams}, StreamID, Req) ->
try cowboy_stream:init(StreamID, Req, Opts) of
{Commands, StreamState} ->