anchor.diff:  
   next(Req, State, Next) when is_function(Next) ->
     Next(Req, State);
  -next(Req, State, StatusCode) when is_integer(StatusCode) andalso StatusCode >= 500 ->
  -  {ok, Req2} = cowboy_req:reply(StatusCode, Req),
  -  error_terminate(Req2, State);
   next(Req, State, StatusCode) when is_integer(StatusCode) ->
     respond(Req, State, StatusCode).
   
  
positive.code:   -> {ok, Req, Env} | {error, 500, Req}
    when Req::cowboy_req:req(), Env::cowboy_middleware:env().
  upgrade(Req, Env, Handler, HandlerOpts) ->
    try
      [Method, Headers] = cowboy_req:get([method, headers], Req),
      case erlang:function_exported(Handler, proxy_init, 2) of
        true ->
          try Handler:proxy_init(Req, HandlerOpts) of
            {ok, Req2, HandlerState} ->
              backend(Req2, #state{env=Env, method=Method, req_headers=Headers,
                handler=Handler, handler_state=HandlerState})
          catch Class:Reason ->
            error_logger:error_msg(
              "** Cowboy handler ~p terminating in ~p/~p~n"
              "   for the reason ~p:~p~n** Options were ~p~n"
              "** Request was ~p~n** Stacktrace: ~p~n~n",
              [Handler, proxy_init, 2, Class, Reason, HandlerOpts,
                cowboy_req:to_list(Req), erlang:get_stacktrace()]),
            {error, 500, Req}
          end;
        false ->
          backend(Req, #state{env=Env, method=Method,
            handler=Handler})
      end
    catch
      throw:{?MODULE, error} ->
        {error, 500, Req}
    end.
  
  backend(Req, State) ->
  
negative.code:       try
          Handler:Callback(Arg, Req, HandlerState)
        catch Class:Reason ->
          error_terminate(Req, State, Class, Reason, Callback, 3)
        end;
      false ->
        no_call
  