Permalink
Browse files

DNS labels are to be treated case-insensitively.

  • Loading branch information...
tonyg committed Mar 9, 2009
1 parent 86151ac commit e136f9108e1c266c39f8da30c4b86c3778e9c5b4
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/reflect_request_queue.erl
@@ -23,7 +23,8 @@ handle(Req, ExceptionHosts) ->
case Req:get_header_value(host) of
undefined ->
error(Req, 400, "Missing Host HTTP header");
- Host ->
+ MixedCaseHost ->
+ Host = string:to_lower(MixedCaseHost),
case lists:keysearch(Host, 1, ExceptionHosts) of
{value, {_, AccessPoints}} ->
%% The request was for one of our configured
@@ -115,7 +116,8 @@ handle_reverse_http(Req, 'POST', AP, [], UrlQueryFields) ->
end,
QueryFields = BodyQueryFields ++ UrlQueryFields,
case lists:keysearch("name", 1, QueryFields) of
- {value, {_, HostLabel}} ->
+ {value, {_, MixedCaseHostLabel}} ->
+ HostLabel = string:to_lower(MixedCaseHostLabel),
Token = case lists:keysearch("token", 1, QueryFields) of
{value, {_, T}} -> T;
false -> random_id(HostLabel)
@@ -210,7 +212,7 @@ handle_meta(Req, AP, PathComponents, QueryFields) ->
%%--------------------------------------------------------------------
expand_host_label(Req, HostLabel) ->
- HostLabel ++ "." ++ Req:get_header_value(host).
+ HostLabel ++ "." ++ string:to_lower(Req:get_header_value(host)).
format_ext_vhost_url(Req, HostLabel) ->
"http://" ++ expand_host_label(Req, HostLabel) ++ "/".

0 comments on commit e136f91

Please sign in to comment.