Function: url-digest-auth-directory-id-assoc

url-digest-auth-directory-id-assoc is a byte-compiled function defined in url-auth.el.gz.

Signature

(url-digest-auth-directory-id-assoc DIRKEY KEYLIST)

Documentation

Find the best match for DIRKEY in key alist KEYLIST.

The string DIRKEY should be obtained using url-digest-auth-directory-id. The key list to search through is the alist KEYLIST where car of each element may match DIRKEY. If DIRKEY represents a realm, the list is searched only for an exact match. For directory names, an ancestor is sufficient for a match.

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-auth.el.gz
(defun url-digest-auth-directory-id-assoc (dirkey keylist)
  "Find the best match for DIRKEY in key alist KEYLIST.

The string DIRKEY should be obtained using
`url-digest-auth-directory-id'.  The key list to search through
is the alist KEYLIST where car of each element may match DIRKEY.
If DIRKEY represents a realm, the list is searched only for an
exact match.  For directory names, an ancestor is sufficient for
a match."
  (or
   ;; Check exact match first.
   (assoc dirkey keylist)
   ;; No exact match found.  Continue to look for partial match if
   ;; dirkey is not a realm.
   (and (string-search "/" dirkey)
        (let (match)
          (while (and (null match) keylist)
            (if (or
                 ;; Any realm candidate matches.  Why?
                 (not (string-search "/" (caar keylist)))
                 ;; Parent directory matches.
                 (string-prefix-p (caar keylist) dirkey))
                (setq match (car keylist))
              (setq keylist (cdr keylist))))
          match))))