anchor.diff:      end;
   % logout by deleting the session
   handle_session_req(#httpd{method='DELETE'}=Req) ->
  -    Cookie = mochiweb_cookies:cookie("AuthSession", "", [{path, "/"}, {http_only, true}]),
  +    Cookie = mochiweb_cookies:cookie("AuthSession", "", [{path, "/"}, cookie_scheme(Req)]),
       {Code, Headers} = case couch_httpd:qs_value(Req, "next", nil) of
           nil ->
               {200, [Cookie]};
  
positive.code: make_cookie_time() ->
      {NowMS, NowS, _} = erlang:now(),
      NowMS * 1000000 + NowS.
  
negative.code:     AuthSession = couch_util:get_value("AuthSession", Cookies),
      if AuthSession == undefined ->
          TimeStamp = make_cookie_time(),
          [cookie_auth_cookie(Req, ?b2l(User), Secret, TimeStamp)];
      true ->
          []
      end;
  cookie_auth_header(_Req, _Headers) -> [].
  
  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)]).
  
  hash_password(Password, Salt) ->
      ?l2b(couch_util:to_hex(crypto:sha(<<Password/binary, Salt/binary>>))).
  