From 6fa734b487102ed1436fd61598d51817a46a9b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 30 Aug 2012 23:11:24 +0200 Subject: Replace cowboy_req:host/1 with cowboy_req:raw_host/1 The latter is much more useful than the former, which ends up being removed. --- src/cowboy_req.erl | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/cowboy_req.erl') diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 5bb9fc5..54693f7 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -28,7 +28,6 @@ -export([peer_addr/1]). -export([host/1]). -export([host_info/1]). --export([raw_host/1]). -export([port/1]). -export([path/1]). -export([path_info/1]). @@ -131,8 +130,8 @@ peer_addr(Req = #http_req{}) -> end, {PeerAddr, Req3}. -%% @doc Return the tokens for the hostname requested. --spec host(Req) -> {cowboy_dispatcher:tokens(), Req} when Req::req(). +%% @doc Return the host binary string. +-spec host(Req) -> {binary(), Req} when Req::req(). host(Req) -> {Req#http_req.host, Req}. @@ -143,11 +142,6 @@ host(Req) -> host_info(Req) -> {Req#http_req.host_info, Req}. -%% @doc Return the raw host directly taken from the request. --spec raw_host(Req) -> {binary(), Req} when Req::req(). -raw_host(Req) -> - {Req#http_req.raw_host, Req}. - %% @doc Return the port used for this request. -spec port(Req) -> {inet:port_number(), Req} when Req::req(). port(Req) -> @@ -826,12 +820,12 @@ upgrade_reply(Status, Headers, Req=#http_req{ %% @doc Compact the request data by removing all non-system information. %% -%% This essentially removes the host, path, query string, bindings and headers. +%% This essentially removes the path, query string, bindings and headers. %% Use it when you really need to save up memory, for example when having %% many concurrent long-running connections. -spec compact(Req) -> Req when Req::req(). compact(Req) -> - Req#http_req{host=undefined, host_info=undefined, path=undefined, + Req#http_req{host_info=undefined, path=undefined, path_info=undefined, qs_vals=undefined, bindings=undefined, headers=[], p_headers=[], cookies=[]}. -- cgit v1.2.3