diff options
| author | Magnus Henoch | 2006-11-02 23:06:20 +0000 |
|---|---|---|
| committer | Magnus Henoch | 2006-11-02 23:06:20 +0000 |
| commit | 8917392a520c6790e51c0febc084738c7db29d62 (patch) | |
| tree | 5fa0e1bf1b58842bc9972d11e72a86c51c4a207a | |
| parent | 1a858672d80475d91fb57cad15c700a1ef0f77b0 (diff) | |
| download | emacs-8917392a520c6790e51c0febc084738c7db29d62.tar.gz emacs-8917392a520c6790e51c0febc084738c7db29d62.zip | |
(url-http-handle-authentication): If there are several authentication
headers, use the first with a supported method.
| -rw-r--r-- | lisp/url/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 24 |
2 files changed, 22 insertions, 8 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 1d4c4aa24fc..678e7e5a8db 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2006-11-03 Shun-ichi GOTO <gotoh@taiyo.co.jp> (tiny change) | ||
| 2 | |||
| 3 | * url-http.el (url-http-handle-authentication): If there are | ||
| 4 | several authentication headers, use the first with a supported | ||
| 5 | method. | ||
| 6 | |||
| 1 | 2006-11-01 Magnus Henoch <mange@freemail.hu> | 7 | 2006-11-01 Magnus Henoch <mange@freemail.hu> |
| 2 | 8 | ||
| 3 | * url-http.el (url-http-create-request): Use buffer-local | 9 | * url-http.el (url-http-create-request): Use buffer-local |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 6b6ec7d6b22..c0bc2d9739e 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -305,21 +305,29 @@ This allows us to use `mail-fetch-field', etc." | |||
| 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 |