aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_dispatcher.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy_dispatcher.erl')
-rw-r--r--src/cowboy_dispatcher.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cowboy_dispatcher.erl b/src/cowboy_dispatcher.erl
index 8370d31..47da5cb 100644
--- a/src/cowboy_dispatcher.erl
+++ b/src/cowboy_dispatcher.erl
@@ -22,7 +22,11 @@
-spec split_host(Host::string()) -> Tokens::path_tokens().
split_host(Host) ->
- string:tokens(Host, ".").
+ Host2 = case string:chr(Host, $:) of
+ 0 -> Host;
+ N -> lists:sublist(Host, N - 1)
+ end,
+ string:tokens(Host2, ".").
-spec split_path(Path::string())
-> {Tokens::path_tokens(), Path::string(), Qs::string()}.
@@ -112,6 +116,7 @@ split_host_test_() ->
{"cowboy.dev-extend.eu", ["cowboy", "dev-extend", "eu"]},
{"dev-extend..eu", ["dev-extend", "eu"]},
{"dev-extend.eu", ["dev-extend", "eu"]},
+ {"dev-extend.eu:8080", ["dev-extend", "eu"]},
{"a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z",
["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]}