aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-03-19 14:16:17 +0100
committerLoïc Hoguin <[email protected]>2011-03-19 14:16:17 +0100
commitdb715a3eb1d5442adf524e85541392a9b4eafe43 (patch)
tree960bf857eb274099beea08d74c0b7bcf97cc1507 /src
parent2131a935e6a9b602ce068359cae6164d43f8cb57 (diff)
downloadcowboy-db715a3eb1d5442adf524e85541392a9b4eafe43.tar.gz
cowboy-db715a3eb1d5442adf524e85541392a9b4eafe43.tar.bz2
cowboy-db715a3eb1d5442adf524e85541392a9b4eafe43.zip
Comparisons of host names MUST be case-insensitive.
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_http_protocol.erl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl
index 6aff959..0e1eb13 100644
--- a/src/cowboy_http_protocol.erl
+++ b/src/cowboy_http_protocol.erl
@@ -84,13 +84,14 @@ wait_header(Req, State=#state{socket=Socket,
Value::string()} | http_eoh, Req::#http_req{}, State::#state{}) -> ok.
header({http_header, _I, 'Host', _R, Value}, Req=#http_req{path=Path},
State=#state{dispatch=Dispatch}) ->
- Host = cowboy_dispatcher:split_host(Value),
+ Value2 = string:to_lower(Value),
+ Host = cowboy_dispatcher:split_host(Value2),
%% @todo We probably want to filter the Host and Path here to allow
%% things like url rewriting.
case cowboy_dispatcher:match(Host, Path, Dispatch) of
{ok, Handler, Opts, Binds} ->
wait_header(Req#http_req{host=Host, bindings=Binds,
- headers=[{'Host', Value}|Req#http_req.headers]},
+ headers=[{'Host', Value2}|Req#http_req.headers]},
State#state{handler={Handler, Opts}});
{error, notfound} ->
error_terminate(404, State)