aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_protocol.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-09-29 11:08:59 +0200
committerLoïc Hoguin <[email protected]>2012-09-29 11:08:59 +0200
commitc326a195e0b1a8d1b8ea338ae9e98d8606895641 (patch)
treede0d27c285f812c7c144718d22d1e89b2874efcc /src/cowboy_protocol.erl
parent0b82eebed654bd894802acb52697a4d4187cb228 (diff)
downloadcowboy-c326a195e0b1a8d1b8ea338ae9e98d8606895641.tar.gz
cowboy-c326a195e0b1a8d1b8ea338ae9e98d8606895641.tar.bz2
cowboy-c326a195e0b1a8d1b8ea338ae9e98d8606895641.zip
Add cowboy_req:get/2 and :set/2 private functions
They should not be used unless you have a very special need, which generally involves interacting with the internals of Cowboy.
Diffstat (limited to 'src/cowboy_protocol.erl')
-rw-r--r--src/cowboy_protocol.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl
index b0b5aa6..77ddc2e 100644
--- a/src/cowboy_protocol.erl
+++ b/src/cowboy_protocol.erl
@@ -437,7 +437,7 @@ onrequest(Req, State=#state{onrequest=undefined}, Host, Path) ->
dispatch(Req, State, Host, Path);
onrequest(Req, State=#state{onrequest=OnRequest}, Host, Path) ->
Req2 = OnRequest(Req),
- case cowboy_req:get_resp_state(Req2) of
+ case cowboy_req:get(resp_state, Req2) of
waiting -> dispatch(Req2, State, Host, Path);
_ -> next_request(Req2, State, ok)
end.
@@ -597,13 +597,13 @@ terminate_request(Req, State, Handler, HandlerState) ->
-spec next_request(cowboy_req:req(), #state{}, any()) -> ok.
next_request(Req, State=#state{req_keepalive=Keepalive}, HandlerRes) ->
cowboy_req:ensure_response(Req, 204),
- {BodyRes, Buffer} = case cowboy_req:skip_body(Req) of
- {ok, Req2} -> {ok, cowboy_req:get_buffer(Req2)};
- {error, _} -> {close, <<>>}
+ {BodyRes, [Buffer, Connection]} = case cowboy_req:skip_body(Req) of
+ {ok, Req2} -> {ok, cowboy_req:get([buffer, connection], Req2)};
+ {error, _} -> {close, [<<>>, close]}
end,
%% Flush the resp_sent message before moving on.
receive {cowboy_req, resp_sent} -> ok after 0 -> ok end,
- case {HandlerRes, BodyRes, cowboy_req:get_connection(Req)} of
+ case {HandlerRes, BodyRes, Connection} of
{ok, ok, keepalive} ->
?MODULE:parse_request(Buffer, State#state{
req_keepalive=Keepalive + 1}, 0);