0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-16 05:00:24 +00:00

Make sure an incorrect port returns a 400 error

This commit is contained in:
Loïc Hoguin 2012-12-22 16:45:04 +01:00
parent cc65a723d7
commit 7ff2a62585
2 changed files with 4 additions and 1 deletions

View file

@ -379,7 +379,9 @@ request(B, State=#state{transport=Transport}, M, P, Q, F, Version, Headers) ->
request(B, State, M, P, Q, F, Version, Headers,
<<>>, default_port(Transport:name()));
{_, RawHost} ->
case parse_host(RawHost, <<>>) of
case catch parse_host(RawHost, <<>>) of
{'EXIT', _} ->
error_terminate(400, State);
{Host, undefined} ->
request(B, State, M, P, Q, F, Version, Headers,
Host, default_port(Transport:name()));