diff options
author | Loïc Hoguin <[email protected]> | 2011-03-20 18:03:11 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-03-20 18:03:36 +0100 |
commit | 71b31cee92f5e0c92f57e94c4916e9e19bbafb3f (patch) | |
tree | ef6fae811b5499483edd341bd250ff73d3d27bf8 /include | |
parent | d69d0adfa72383736fe9705f5060881baefe2d21 (diff) | |
download | cowboy-71b31cee92f5e0c92f57e94c4916e9e19bbafb3f.tar.gz cowboy-71b31cee92f5e0c92f57e94c4916e9e19bbafb3f.tar.bz2 cowboy-71b31cee92f5e0c92f57e94c4916e9e19bbafb3f.zip |
Make sure we can only reply to an HTTP request inside Handler:handle.
Of course since requests are a record the response state can be explicitly
overriden, but standard use prevents errors by making sure only one reply
is sent.
Diffstat (limited to 'include')
-rw-r--r-- | include/http.hrl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/http.hrl b/include/http.hrl index a36fa93..e0fe4f6 100644 --- a/include/http.hrl +++ b/include/http.hrl @@ -13,9 +13,12 @@ %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -record(http_req, { + %% Transport. socket = undefined :: undefined | socket(), transport = undefined :: undefined | module(), connection = keepalive :: keepalive | close, + + %% Request. method = 'GET' :: http_method(), version = {1, 1} :: http_version(), peer = undefined :: undefined | {Address::ip_address(), Port::port_number()}, @@ -26,6 +29,9 @@ qs_vals = undefined :: undefined | bindings(), raw_qs = undefined :: undefined | string(), bindings = undefined :: undefined | bindings(), - headers = [] :: http_headers() + headers = [] :: http_headers(), %% cookies = undefined :: undefined | http_cookies() %% @todo + + %% Response. + resp_state = locked :: locked | waiting | done }). |