From e55ec7d43d6c06131afe61c8087ca9af97db35fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 17 Sep 2012 00:48:11 +0200 Subject: Add the private get_resp_state/1 function used by cowboy_protocol --- src/cowboy_protocol.erl | 2 +- src/cowboy_req.erl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl index 9042117..868bf22 100644 --- a/src/cowboy_protocol.erl +++ b/src/cowboy_protocol.erl @@ -233,7 +233,7 @@ onrequest(Req, State=#state{onrequest=undefined}) -> dispatch(Req, State); onrequest(Req, State=#state{onrequest=OnRequest}) -> Req2 = OnRequest(Req), - case Req2#http_req.resp_state of + case cowboy_req:get_resp_state(Req2) of waiting -> dispatch(Req2, State); _ -> next_request(Req2, State, ok) end. diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index acee88b..583a3ab 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -108,6 +108,7 @@ -export([add_header/3]). -export([set_buffer/2]). -export([set_bindings/4]). +-export([get_resp_state/1]). %% Misc API. -export([compact/1]). @@ -949,6 +950,11 @@ set_bindings(HostInfo, PathInfo, Bindings, Req) -> Req#http_req{host_info=HostInfo, path_info=PathInfo, bindings=Bindings}. +%% @private +-spec get_resp_state(req()) -> locked | waiting | chunks | done. +get_resp_state(#http_req{resp_state=RespState}) -> + RespState. + %% Misc API. %% @doc Compact the request data by removing all non-system information. -- cgit v1.2.3