anchor.diff:  	case erlang:decode_packet(http_bin, Buffer, []) of
   		{ok, Request, Rest} -> request(Request, State#state{buffer=Rest});
   		{more, _Length} -> wait_request(State);
  -		{error, _Reason} -> error_response(400, State)
  +		{error, _Reason} -> error_terminate(400, State)
   	end.
   
   -spec wait_request(#state{}) -> ok.
  
positive.code: 	case erlang:decode_packet(httph_bin, Buffer, []) of
  		{ok, Header, Rest} -> header(Header, Req, State#state{buffer=Rest});
  		{more, _Length} -> wait_header(Req, State);
  		{error, _Reason} -> error_response(400, State)
  	end.
  
  -spec wait_header(#http_req{}, #state{}) -> ok.
  
negative.code: 		_Any -> ok
  	end.
  
  -spec ensure_response(#http_req{}) -> ok.
  %% The handler has already fully replied to the client.
  ensure_response(#http_req{resp_state=done}) ->
  	ok;
  %% No response has been sent but everything apparently went fine.
  %% Reply with 204 No Content to indicate this.
  ensure_response(Req=#http_req{resp_state=waiting}) ->
  	_ = cowboy_http_req:reply(204, [], [], Req),
  	ok;
  %% Close the chunked reply.
  ensure_response(#http_req{socket=Socket, transport=Transport,
  		resp_state=chunks}) ->
  	Transport:send(Socket, <<"0\r\n\r\n">>),
  	close.
  
  -spec error_terminate(http_status(), #state{}) -> ok.
  error_terminate(Code, State=#state{socket=Socket, transport=Transport}) ->
  	_ = cowboy_http_req:reply(Code, [], [], #http_req{
  		socket=Socket, transport=Transport,
  		connection=close, resp_state=waiting}),
  	terminate(State).
  
  -spec terminate(#state{}) -> ok.
  