aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-12-22 16:45:04 +0100
committerLoïc Hoguin <[email protected]>2012-12-22 16:45:04 +0100
commit7ff2a62585258e65830e80d5ac0abb75b9c1cf0b (patch)
tree653fe665b2919b2a86a6eb905c0c05f9498da606 /src
parentcc65a723d70bb078b048bab81eeb8a4bd7ed39ce (diff)
downloadcowboy-7ff2a62585258e65830e80d5ac0abb75b9c1cf0b.tar.gz
cowboy-7ff2a62585258e65830e80d5ac0abb75b9c1cf0b.tar.bz2
cowboy-7ff2a62585258e65830e80d5ac0abb75b9c1cf0b.zip
Make sure an incorrect port returns a 400 error
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_protocol.erl4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl
index 0d15f32..7ab66a9 100644
--- a/src/cowboy_protocol.erl
+++ b/src/cowboy_protocol.erl
@@ -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()));