diff options
author | Loïc Hoguin <[email protected]> | 2012-09-16 15:51:15 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-09-17 13:57:28 +0200 |
commit | 6dbc1f9ef98eda6cfdffc0a47b68fb50eeb3863a (patch) | |
tree | 7e395e8aba07811cac5d364567bed26046c45257 /src/cowboy_req.erl | |
parent | c1f5a2acb2bcd6e9ba549bf5d3c3fd0c6789aeae (diff) | |
download | cowboy-6dbc1f9ef98eda6cfdffc0a47b68fb50eeb3863a.tar.gz cowboy-6dbc1f9ef98eda6cfdffc0a47b68fb50eeb3863a.tar.bz2 cowboy-6dbc1f9ef98eda6cfdffc0a47b68fb50eeb3863a.zip |
Add a private cowboy_req function to create a Req object
Private means you must not used it. It's meant for internal use.
Diffstat (limited to 'src/cowboy_req.erl')
-rw-r--r-- | src/cowboy_req.erl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 741a8f1..80d68a9 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -42,6 +42,7 @@ -module(cowboy_req). %% Request API. +-export([new/9]). -export([method/1]). -export([version/1]). -export([peer/1]). @@ -115,6 +116,20 @@ %% Request API. +%% @doc Create a new HTTP Req object. +%% +%% This function takes care of setting the owner's pid to self(). +%% @private +-spec new(inet:socket(), module(), keepalive | close, + cowboy_http:method(), cowboy_http:version(), binary(), binary(), + undefined | fun(), undefined | {fun(), atom()}) + -> req(). +new(Socket, Transport, Connection, Method, Version, Path, Qs, + OnResponse, URLDecode) -> + #http_req{socket=Socket, transport=Transport, connection=Connection, + pid=self(), method=Method, version=Version, path=Path, raw_qs=Qs, + onresponse=OnResponse, urldecode=URLDecode}. + %% @doc Return the HTTP method of the request. -spec method(Req) -> {cowboy_http:method(), Req} when Req::req(). method(Req) -> |