|
@@ -1119,7 +1119,8 @@ stream_req_init(State=#state{ref=Ref, peer=Peer, sock=Sock, cert=Cert},
|
|
StreamID, IsFin, Headers, PseudoHeaders=#{method := Method, scheme := Scheme,
|
|
StreamID, IsFin, Headers, PseudoHeaders=#{method := Method, scheme := Scheme,
|
|
authority := Authority, path := PathWithQs}, BodyLength) ->
|
|
authority := Authority, path := PathWithQs}, BodyLength) ->
|
|
try cow_http_hd:parse_host(Authority) of
|
|
try cow_http_hd:parse_host(Authority) of
|
|
- {Host, Port} ->
|
|
|
|
|
|
+ {Host, Port0} ->
|
|
|
|
+ Port = ensure_port(Scheme, Port0),
|
|
try cow_http:parse_fullpath(PathWithQs) of
|
|
try cow_http:parse_fullpath(PathWithQs) of
|
|
{<<>>, _} ->
|
|
{<<>>, _} ->
|
|
stream_malformed(State, StreamID,
|
|
stream_malformed(State, StreamID,
|
|
@@ -1160,6 +1161,10 @@ stream_req_init(State=#state{ref=Ref, peer=Peer, sock=Sock, cert=Cert},
|
|
'The :authority pseudo-header is invalid. (RFC7540 8.1.2.3)')
|
|
'The :authority pseudo-header is invalid. (RFC7540 8.1.2.3)')
|
|
end.
|
|
end.
|
|
|
|
|
|
|
|
+ensure_port(<<"http">>, undefined) -> 80;
|
|
|
|
+ensure_port(<<"https">>, undefined) -> 443;
|
|
|
|
+ensure_port(_, Port) -> Port.
|
|
|
|
+
|
|
stream_closed(State=#state{socket=Socket, transport=Transport}, StreamID, _) ->
|
|
stream_closed(State=#state{socket=Socket, transport=Transport}, StreamID, _) ->
|
|
Transport:send(Socket, cow_http2:rst_stream(StreamID, stream_closed)),
|
|
Transport:send(Socket, cow_http2:rst_stream(StreamID, stream_closed)),
|
|
State.
|
|
State.
|