anchor.diff:  		{upgrade, protocol, Module, Req2, Opts2} ->
   			upgrade_protocol(Req2, State, Handler, Opts2, Module)
   	catch Class:Reason ->
  -		error_terminate(500, State),
  +		error_terminate(500, Req, State),
   		error_logger:error_msg(
   			"** Cowboy handler ~p terminating in ~p/~p~n"
   			"   for the reason ~p:~p~n"
  
positive.code: 			Req2 = cowboy_req:set_bindings(HostInfo, PathInfo, Bindings, Req),
  			handler_init(Req2, State, Handler, Opts);
  		{error, notfound, host} ->
  			error_terminate(400, State);
  		{error, badrequest, path} ->
  			error_terminate(400, State);
  		{error, notfound, path} ->
  			error_terminate(404, State)
  	end.
  
  -spec handler_init(cowboy_req:req(), #state{}, module(), any()) -> ok.
  
negative.code: 	end.
  
  %% Only send an error reply if there is no resp_sent message.
  -spec error_terminate(cowboy_http:status(), cowboy_req:req(), #state{}) -> ok.
  error_terminate(Code, Req, State) ->
  	receive
  		{cowboy_req, resp_sent} -> ok
  	after 0 ->
  		_ = cowboy_req:reply(Code, Req),
  		ok
  	end,
  	terminate(State).
  
  %% 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,
  		onresponse=OnResponse}) ->
  