Merge from emacs-23 branch
[bpt/emacs.git] / lisp / url / url-methods.el
index 57b9db6..3b86ed4 100644 (file)
@@ -1,7 +1,6 @@
 ;;; url-methods.el --- Load URL schemes as needed
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2011 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
   "Signal an error for an unknown URL scheme."
   (error "Unkown URL scheme: %s" (url-type url)))
 
+(defvar url-scheme--registering-proxy nil)
+
 (defun url-scheme-register-proxy (scheme)
   "Automatically find a proxy for SCHEME and put it in `url-proxy-services'."
   (let* ((env-var (concat scheme "_proxy"))
         (env-proxy (or (getenv (upcase env-var))
                        (getenv (downcase env-var))))
         (cur-proxy (assoc scheme url-proxy-services))
-        (urlobj nil))
+        (urlobj nil)
+        (url-scheme--registering-proxy t))
 
     ;; If env-proxy is an empty string, treat it as if it were nil
     (when (and (stringp env-proxy)
@@ -124,7 +126,8 @@ it has not already been loaded."
          (if (fboundp loader)
              (progn
                ;; Found the module to handle <scheme> URLs
-               (url-scheme-register-proxy scheme)
+               (unless url-scheme--registering-proxy
+                 (url-scheme-register-proxy scheme))
                (setq desc (list 'name scheme
                                 'loader loader))
                (dolist (cell url-scheme-methods)
@@ -150,5 +153,4 @@ it has not already been loaded."
 
 (provide 'url-methods)
 
-;; arch-tag: 336863f8-5a07-4906-9be5-b3c6bcebbe67
 ;;; url-methods.el ends here