From: ueno Date: Mon, 13 Dec 1999 08:45:36 +0000 (+0000) Subject: * digest-md5.el X-Git-Tag: slim-1_13_5~14 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbd39c1bc563b04cad4b4fe5769b35de70803460;p=elisp%2Fflim.git * digest-md5.el (digest-md5-parse-digest-challenge-syntax-table): New variable. (digest-md5-parse-digest-challenge): Use it; return parsed result as a property list. --- diff --git a/digest-md5.el b/digest-md5.el index bd090fc..9ff1d86 100644 --- a/digest-md5.el +++ b/digest-md5.el @@ -48,44 +48,30 @@ (require 'hmac-md5) (require 'unique-id) +(defvar digest-md5-parse-digest-challenge-syntax-table + (let ((table (make-syntax-table))) + (modify-syntax-entry ?= "." table) + (modify-syntax-entry ?, "." table) + table) + "A syntax table for parsing sgml attributes.") + (defun digest-md5-parse-digest-challenge (digest-challenge) - ;; return list of + ;; return a property list of ;; (realm nonce qop-options stale maxbuf charset ;; algorithm cipher-opts auth-param). - (let (realm nonce qop-options stale maxbuf charset - algorithm cipher-opts auth-param - challenges challenge) - (setq challenges - (split-string digest-challenge ",")) - (while (car challenges) - (if (null (string-match - "\\([a-z]+\\)=\"?\\(.+\\)\"?" (car challenges))) - (error "Parse error in digest-challenge1.")) - (setq challenge (cons - (match-string 1 (car challenges)) - (match-string 2 (car challenges)))) - (cond - ((string= (car challenge) "realm") - (setq realm (cdr challenge))) - ((string= (car challenge) "nonce") - (setq nonce (cdr challenge))) - ((string= (car challenge) "qop") - (setq qop-options (cdr challenge))) - ((string= (car challenge) "stale") - (setq stale (cdr challenge))) - ((string= (car challenge) "maxbuf") - (setq maxbuf (cdr challenge))) - ((string= (car challenge) "charset") - (setq charset (cdr challenge))) - ((string= (car challenge) "algorithm") - (setq algorithm (cdr challenge))) - ((string= (car challenge) "cipher") - (setq cipher-opts (cdr challenge))) - (t - (error "Parse error in digest-challenge."))) - (setq challenges (cdr challenges))) - (list realm nonce qop-options stale maxbuf charset - algorithm cipher-opts auth-param))) + (with-temp-buffer + (set-syntax-table digest-md5-parse-challenge-syntax-table) + (insert digest-challenge) + (goto-char (point-min)) + (insert "(") + (while (progn (forward-sexp) (not (eobp))) + (delete-char 1) + (insert " ")) + (insert ")") + (condition-case nil + (read (point-min-marker)) + (end-of-file + (error "Parse error in digest-challenge."))))) (defun digest-md5-digest-uri (serv-type host &optional serv-name) (concat serv-type "/" host