anchor.diff:      , couch_httpd_misc_handlers:handle_utils_dir_req(Req, Dir)
       .
   
  +
  +% These are not exported from couch_httpd_auth.
  +ensure_cookie_auth_secret() ->
  +    case couch_config:get("couch_httpd_auth", "secret", nil) of
  +        nil ->
  +            NewSecret = ?b2l(couch_uuids:random()),
  +            couch_config:set("couch_httpd_auth", "secret", NewSecret),
  +            NewSecret;
  +        Secret -> Secret
  +    end.
  +
  +make_cookie_time() ->
  +    {NowMS, NowS, _} = erlang:now(),
  +    NowMS * 1000000 + NowS.
  +
  +cookie_auth_cookie(Req, User, Secret, TimeStamp) ->
  +    SessionData = User ++ ":" ++ erlang:integer_to_list(TimeStamp, 16),
  +    Hash = crypto:sha_mac(Secret, SessionData),
  +    mochiweb_cookies:cookie("AuthSession",
  +        couch_util:encodeBase64Url(SessionData ++ ":" ++ ?b2l(Hash)),
  +        [{path, "/"}, cookie_scheme(Req)]).
  +
  +cookie_scheme(#httpd{mochi_req=MochiReq}) ->
  +    case MochiReq:get(scheme) of
  +        http -> {http_only, true};
  +        https -> {secure, true}
  +    end.
  +
   % vim: sts=4 sw=4 et
  
positive.code:     end.
  
  
  %
  % Utilities
  %
  
negative.code:         % Send client an error response, couch_util:send_err ...
          not_implemented;
      {ok, Verified_obj} -> ok
          , send_good_id(Req, Verified_obj)
      end;
  
  handle_id_req(_Req) ->
  