Skip to content

Commit

Permalink
handle lack of HTTP/1.1 "Host" header. MB-3239
Browse files Browse the repository at this point in the history
Change-Id: If01ce4de3917364b7888b5d28b76bdbafd6b25d4
Reviewed-on: http://review.membase.org/4285
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information
Aliaksey Kandratsenka authored and steveyen committed Jan 20, 2011
1 parent 185461d commit e84108e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deps/menelaus/src/menelaus_util.erl
Expand Up @@ -62,7 +62,11 @@ redirect_permanently(Path, Req) -> redirect_permanently(Path, Req, []).
%% mostly extracted from mochiweb_request:maybe_redirect/3
redirect_permanently(Path, Req, ExtraHeaders) ->
%% TODO: support https transparently
Location = "http://" ++ Req:get_header_value("host") ++ Path,
Location =
case Req:get_header_value("host") of
undefined -> Path;
X -> "http://" ++ X ++ Path
end,
LocationBin = list_to_binary(Location),
Top = <<"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"
"<html><head>"
Expand Down

0 comments on commit e84108e

Please sign in to comment.