mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-16 13:10:24 +00:00
Remove an unnecessary function
This commit is contained in:
parent
d4129e6305
commit
266178b6bc
1 changed files with 6 additions and 13 deletions
|
@ -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} ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue