diff options
author | Loïc Hoguin <[email protected]> | 2012-05-21 15:17:24 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2012-05-21 15:17:24 +0200 |
commit | cc6c4e39de74f60747178a3e4bff8fdd65b70777 (patch) | |
tree | 521b4176a3f0d51d51a6286aebf4265caee97b94 /src/cowboy_http_protocol.erl | |
parent | ca9278bc27b4d5429e32693901945f5c4796f994 (diff) | |
download | cowboy-cc6c4e39de74f60747178a3e4bff8fdd65b70777.tar.gz cowboy-cc6c4e39de74f60747178a3e4bff8fdd65b70777.tar.bz2 cowboy-cc6c4e39de74f60747178a3e4bff8fdd65b70777.zip |
Fix a bug preventing 'onresponse' from being called on errors
Diffstat (limited to 'src/cowboy_http_protocol.erl')
-rw-r--r-- | src/cowboy_http_protocol.erl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cowboy_http_protocol.erl b/src/cowboy_http_protocol.erl index 7713a7e..9e1ad88 100644 --- a/src/cowboy_http_protocol.erl +++ b/src/cowboy_http_protocol.erl @@ -438,12 +438,13 @@ ensure_response(#http_req{socket=Socket, transport=Transport, %% Only send an error reply if there is no resp_sent message. -spec error_terminate(cowboy_http:status(), #state{}) -> ok. -error_terminate(Code, State=#state{socket=Socket, transport=Transport}) -> +error_terminate(Code, State=#state{socket=Socket, transport=Transport, + onresponse=OnResponse}) -> receive {cowboy_http_req, resp_sent} -> ok after 0 -> _ = cowboy_http_req:reply(Code, #http_req{ - socket=Socket, transport=Transport, + socket=Socket, transport=Transport, onresponse=OnResponse, connection=close, pid=self(), resp_state=waiting}), ok end, |