Browse Source

Save the raw host string in the request.

Loïc Hoguin 14 years ago
parent
commit
8085529f48
2 changed files with 4 additions and 3 deletions
  1. 2 2
      include/http.hrl
  2. 2 1
      src/cowboy_http_protocol.erl

+ 2 - 2
include/http.hrl

@@ -19,8 +19,8 @@
 	method     = 'GET'     :: http_method(),
 	version    = {1, 1}    :: http_version(),
 	peer       = undefined :: undefined | {Address::ip_address(), Port::port_number()},
-	host       = undefined :: undefined | path_tokens(), %% todo
-	raw_host   = undefined :: undefined | string(), %% todo
+	host       = undefined :: undefined | path_tokens(),
+	raw_host   = undefined :: undefined | string(),
 	path       = undefined :: undefined | path_tokens(), %% todo
 	raw_path   = undefined :: undefined | string(), %% todo
 	qs_vals    = undefined :: undefined | bindings(), %% todo

+ 2 - 1
src/cowboy_http_protocol.erl

@@ -101,7 +101,8 @@ header({http_header, _I, 'Host', _R, Value}, Req=#http_req{path=Path,
 	%%       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,
+			wait_header(Req#http_req{
+				host=Host, raw_host=Value2, bindings=Binds,
 				headers=[{'Host', Value2}|Req#http_req.headers]},
 				State#state{handler={Handler, Opts}});
 		{error, notfound, host} ->