aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-09-17 00:52:46 +0200
committerLoïc Hoguin <[email protected]>2012-09-17 13:57:28 +0200
commitcf0e905c52dbd6ada6c260b5e95a78f3cc59d558 (patch)
tree378a8e6ccb8069f75fe17954b8690c1df834de4a
parente55ec7d43d6c06131afe61c8087ca9af97db35fe (diff)
downloadcowboy-cf0e905c52dbd6ada6c260b5e95a78f3cc59d558.tar.gz
cowboy-cf0e905c52dbd6ada6c260b5e95a78f3cc59d558.tar.bz2
cowboy-cf0e905c52dbd6ada6c260b5e95a78f3cc59d558.zip
Add the private get_buffer/1 function used by cowboy_protocol
-rw-r--r--src/cowboy_protocol.erl2
-rw-r--r--src/cowboy_req.erl6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl
index 868bf22..ed51b85 100644
--- a/src/cowboy_protocol.erl
+++ b/src/cowboy_protocol.erl
@@ -394,7 +394,7 @@ next_request(Req=#http_req{connection=Conn}, State=#state{
req_keepalive=Keepalive}, HandlerRes) ->
cowboy_req:ensure_response(Req, 204),
{BodyRes, Buffer} = case cowboy_req:skip_body(Req) of
- {ok, Req2} -> {ok, Req2#http_req.buffer};
+ {ok, Req2} -> {ok, cowboy_req:get_buffer(Req2)};
{error, _} -> {close, <<>>}
end,
%% Flush the resp_sent message before moving on.
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index 583a3ab..e067ea5 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -109,6 +109,7 @@
-export([set_buffer/2]).
-export([set_bindings/4]).
-export([get_resp_state/1]).
+-export([get_buffer/1]).
%% Misc API.
-export([compact/1]).
@@ -955,6 +956,11 @@ set_bindings(HostInfo, PathInfo, Bindings, Req) ->
get_resp_state(#http_req{resp_state=RespState}) ->
RespState.
+%% @private
+-spec get_buffer(req()) -> binary().
+get_buffer(#http_req{buffer=Buffer}) ->
+ Buffer.
+
%% Misc API.
%% @doc Compact the request data by removing all non-system information.