aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_req.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-09-10 12:25:07 +0200
committerLoïc Hoguin <[email protected]>2012-09-10 12:26:04 +0200
commit79839b7bb5ae3aef77eb7ab704efa6168927845f (patch)
tree8ddb398b58d2a2665562e65a031c2b5e7bb84ff8 /src/cowboy_req.erl
parent6fa734b487102ed1436fd61598d51817a46a9b75 (diff)
downloadcowboy-79839b7bb5ae3aef77eb7ab704efa6168927845f.tar.gz
cowboy-79839b7bb5ae3aef77eb7ab704efa6168927845f.tar.bz2
cowboy-79839b7bb5ae3aef77eb7ab704efa6168927845f.zip
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.
Diffstat (limited to 'src/cowboy_req.erl')
-rw-r--r--src/cowboy_req.erl20
1 files changed, 6 insertions, 14 deletions
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 <em>/</em> if, and only if, a <em>/</em> 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=[]}.