0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Add the private get_buffer/1 function used by cowboy_protocol

This commit is contained in:
Loïc Hoguin 2012-09-17 00:52:46 +02:00
parent e55ec7d43d
commit cf0e905c52
2 changed files with 7 additions and 1 deletions

View file

@ -394,7 +394,7 @@ next_request(Req=#http_req{connection=Conn}, State=#state{
req_keepalive=Keepalive}, HandlerRes) -> req_keepalive=Keepalive}, HandlerRes) ->
cowboy_req:ensure_response(Req, 204), cowboy_req:ensure_response(Req, 204),
{BodyRes, Buffer} = case cowboy_req:skip_body(Req) of {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, <<>>} {error, _} -> {close, <<>>}
end, end,
%% Flush the resp_sent message before moving on. %% Flush the resp_sent message before moving on.

View file

@ -109,6 +109,7 @@
-export([set_buffer/2]). -export([set_buffer/2]).
-export([set_bindings/4]). -export([set_bindings/4]).
-export([get_resp_state/1]). -export([get_resp_state/1]).
-export([get_buffer/1]).
%% Misc API. %% Misc API.
-export([compact/1]). -export([compact/1]).
@ -955,6 +956,11 @@ set_bindings(HostInfo, PathInfo, Bindings, Req) ->
get_resp_state(#http_req{resp_state=RespState}) -> get_resp_state(#http_req{resp_state=RespState}) ->
RespState. RespState.
%% @private
-spec get_buffer(req()) -> binary().
get_buffer(#http_req{buffer=Buffer}) ->
Buffer.
%% Misc API. %% Misc API.
%% @doc Compact the request data by removing all non-system information. %% @doc Compact the request data by removing all non-system information.