anchor.diff:      decision(DecisionID, State, Context).
   
   respond(Code, State, Context) ->
  -    {RsCode, RdCode} = case Code of
  -        200 ->
  -            case cowmachine_req:get_req_header(<<"te">>, Context) of
  -                undefined -> {State, Context};
  -                TEHdr -> choose_transfer_encoding(TEHdr, State, Context)
  -            end;
  -        Code when Code =:= 403; Code =:= 404; Code =:= 410 ->
  -            controller_call(finish_request, State, Context),
  -            throw({stop_request, Code});
  -        304 ->
  -            RdNoCT = cowmachine_req:remove_resp_header(<<"content-type">>, Context),
  -            {Etag, StateEt, RdEt0} = controller_call(generate_etag, State, RdNoCT),
  -            RdEt = case Etag of
  -                undefined -> RdEt0;
  -                ETag -> cowmachine_req:set_resp_header(<<"etag">>, cow_uri:urlencode(ETag), RdEt0)
  +    {State1, Context1} = case Code of
  +        Ok when Ok >= 200, Ok =< 299 ->
  +            % Response all ok
  +            {State, Context};
  +        301 ->
  +            % Permanent redirect
  +            {State, Context};
  +        R when R =:= 304; R =:= 307; R =:= 310 ->
  +            % Temp redirects have no content and should not be cached
  +            CtxNoCT = cowmachine_req:remove_resp_header(<<"content-type">>, Context),
  +            {Etag, StateEt, CtxEt0} = controller_call(generate_etag, State, CtxNoCT),
  +            CtxEt = case Etag of
  +                undefined -> CtxEt0;
  +                ETag -> cowmachine_req:set_resp_header(<<"etag">>, cow_uri:urlencode(ETag), CtxEt0)
               end,
  -            {Expires, StateExp, ExpCtx0} = controller_call(expires, StateEt, RdEt),
  +            {Expires, StateExp, ExpCtx0} = controller_call(expires, StateEt, CtxEt),
               ExpCtx = case Expires of
                   undefined ->
                       ExpCtx0;
  
positive.code:                end,
      {IsAuthorized, S1, C1} = controller_call(is_authorized, State, Context1),
      case IsAuthorized of
          true -> 
              d(v3b7, S1, C1);
          {error, Reason} ->
              error_response(Reason, S1, C1);
          {halt, Code}  ->
              respond(Code, S1, C1);
          AuthHead ->
              CtxAuth = cowmachine_req:set_resp_header(<<"www-authenticate">>, AuthHead, C1),
              respond(401, S1, CtxAuth)
      end;
  
  %% "Forbidden?"
  
negative.code: 
  -export([handle_request/2]).
  
  -export([respond/3]).
  
  -include("cowmachine_state.hrl").
  
  handle_request(#cmstate{ controller = Controller } = CmState, Context) ->
  