From 79839b7bb5ae3aef77eb7ab704efa6168927845f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 10 Sep 2012 12:25:07 +0200 Subject: Replace cowboy_req:path/1 with cowboy_req:raw_path/1 The latter is much more useful than the former, which ends up being removed. --- src/cowboy_req.erl | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/cowboy_req.erl') diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 54693f7..fd1399d 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -31,7 +31,6 @@ -export([port/1]). -export([path/1]). -export([path_info/1]). --export([raw_path/1]). -export([qs_val/2]). -export([qs_val/3]). -export([qs_vals/1]). @@ -147,12 +146,8 @@ host_info(Req) -> port(Req) -> {Req#http_req.port, Req}. -%% @doc Return the path segments for the path requested. -%% -%% Following RFC2396, this function may return path segments containing any -%% character, including / if, and only if, a / was escaped -%% and part of a path segment in the path requested. --spec path(Req) -> {cowboy_dispatcher:tokens(), Req} when Req::req(). +%% @doc Return the path binary string. +-spec path(Req) -> {binary(), Req} when Req::req(). path(Req) -> {Req#http_req.path, Req}. @@ -163,11 +158,6 @@ path(Req) -> path_info(Req) -> {Req#http_req.path_info, Req}. -%% @doc Return the raw path directly taken from the request. --spec raw_path(Req) -> {binary(), Req} when Req::req(). -raw_path(Req) -> - {Req#http_req.raw_path, Req}. - %% @equiv qs_val(Name, Req, undefined) -spec qs_val(binary(), Req) -> {binary() | true | undefined, Req} when Req::req(). @@ -820,12 +810,14 @@ upgrade_reply(Status, Headers, Req=#http_req{ %% @doc Compact the request data by removing all non-system information. %% -%% This essentially removes the path, query string, bindings and headers. +%% This essentially removes the host and path info, query string, bindings, +%% headers and cookies. +%% %% 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_info=undefined, path=undefined, + Req#http_req{host_info=undefined, path_info=undefined, qs_vals=undefined, bindings=undefined, headers=[], p_headers=[], cookies=[]}. -- cgit v1.2.3