mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Improve state reset between requests
This commit is contained in:
parent
8a6baac9ad
commit
ff3c5c7f45
1 changed files with 2 additions and 3 deletions
|
@ -433,8 +433,7 @@ terminate_request(HandlerState, Req, State) ->
|
|||
next_request(Req, State, HandlerRes).
|
||||
|
||||
-spec next_request(cowboy_req:req(), #state{}, any()) -> ok.
|
||||
next_request(Req, State=#state{
|
||||
req_keepalive=Keepalive}, HandlerRes) ->
|
||||
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)};
|
||||
|
@ -445,7 +444,7 @@ next_request(Req, State=#state{
|
|||
case {HandlerRes, BodyRes, cowboy_req:get_connection(Req)} of
|
||||
{ok, ok, keepalive} ->
|
||||
?MODULE:parse_request(State#state{
|
||||
buffer=Buffer, host_tokens=undefined, path_tokens=undefined,
|
||||
handler=undefined, buffer=Buffer,
|
||||
req_empty_lines=0, req_keepalive=Keepalive + 1});
|
||||
_Closed ->
|
||||
terminate(State)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue