Browse Source

Move the ensure_response call before ensure_body_processed

We want to reply as soon as possible.
Loïc Hoguin 13 years ago
parent
commit
ba87aa4193
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/cowboy_http_protocol.erl

+ 1 - 1
src/cowboy_http_protocol.erl

@@ -357,8 +357,8 @@ terminate_request(HandlerState, Req, State) ->
 next_request(Req=#http_req{connection=Conn, buffer=Buffer},
 		State=#state{req_keepalive=Keepalive, max_keepalive=MaxKeepalive},
 		HandlerRes) ->
-	BodyRes = ensure_body_processed(Req),
 	RespRes = ensure_response(Req),
+	BodyRes = ensure_body_processed(Req),
 	case {HandlerRes, BodyRes, RespRes, Conn} of
 		{ok, ok, ok, keepalive} when Keepalive < MaxKeepalive ->
 			?MODULE:parse_request(State#state{