comparison lisp/url/url-http.el @ 73626:064fe7ff7747

(url-http-handle-authentication): If there are several authentication headers, use the first with a supported method.
author Magnus Henoch <mange@freemail.hu>
date Thu, 02 Nov 2006 23:06:20 +0000
parents fe1f7fc1d1d6
children 8368b321b13d
comparison
equal deleted inserted replaced
73625:b4c429c0017c 73626:064fe7ff7747
303 303
304 (defun url-http-handle-authentication (proxy) 304 (defun url-http-handle-authentication (proxy)
305 (declare (special status success url-http-method url-http-data 305 (declare (special status success url-http-method url-http-data
306 url-callback-function url-callback-arguments)) 306 url-callback-function url-callback-arguments))
307 (url-http-debug "Handling %s authentication" (if proxy "proxy" "normal")) 307 (url-http-debug "Handling %s authentication" (if proxy "proxy" "normal"))
308 (let ((auth (or (mail-fetch-field (if proxy "proxy-authenticate" "www-authenticate")) 308 (let ((auths (or (nreverse
309 "basic")) 309 (mail-fetch-field
310 (if proxy "proxy-authenticate" "www-authenticate")
311 nil nil t))
312 '("basic")))
310 (type nil) 313 (type nil)
311 (url (url-recreate-url url-current-object)) 314 (url (url-recreate-url url-current-object))
312 (url-basic-auth-storage 'url-http-real-basic-auth-storage) 315 (url-basic-auth-storage 'url-http-real-basic-auth-storage)
313 ) 316 auth)
314
315 ;; Cheating, but who cares? :) 317 ;; Cheating, but who cares? :)
316 (if proxy 318 (if proxy
317 (setq url-basic-auth-storage 'url-http-proxy-basic-auth-storage)) 319 (setq url-basic-auth-storage 'url-http-proxy-basic-auth-storage))
318 320
319 (setq auth (url-eat-trailing-space (url-strip-leading-spaces auth))) 321 ;; find first supported auth
320 (if (string-match "[ \t]" auth) 322 (while auths
321 (setq type (downcase (substring auth 0 (match-beginning 0)))) 323 (setq auth (url-eat-trailing-space (url-strip-leading-spaces (car auths))))
322 (setq type (downcase auth))) 324 (if (string-match "[ \t]" auth)
325 (setq type (downcase (substring auth 0 (match-beginning 0))))
326 (setq type (downcase auth)))
327 (if (url-auth-registered type)
328 (setq auths nil) ; no more check
329 (setq auth nil
330 auths (cdr auths))))
323 331
324 (if (not (url-auth-registered type)) 332 (if (not (url-auth-registered type))
325 (progn 333 (progn
326 (widen) 334 (widen)
327 (goto-char (point-max)) 335 (goto-char (point-max))