((and prompt (not byserv))
(setq user (or
(url-do-auth-source-search server type :user)
- (read-string (url-auth-user-prompt href realm)
- (or user (user-real-login-name))))
+ (and (url-interactive-p)
+ (read-string (url-auth-user-prompt href realm)
+ (or user (user-real-login-name)))))
pass (or
(url-do-auth-source-search server type :secret)
- (read-passwd "Password: " nil (or pass ""))))
+ (and (url-interactive-p)
+ (read-passwd "Password: " nil (or pass "")))))
(set url-basic-auth-storage
(cons (list server
(cons file
(progn
(setq user (or
(url-do-auth-source-search server type :user)
- (read-string (url-auth-user-prompt href realm)
- (user-real-login-name)))
+ (and (url-interactive-p)
+ (read-string (url-auth-user-prompt href realm)
+ (user-real-login-name))))
pass (or
(url-do-auth-source-search server type :secret)
- (read-passwd "Password: "))
+ (and (url-interactive-p)
+ (read-passwd "Password: ")))
retval (base64-encode-string (format "%s:%s" user pass) t)
byserv (assoc server (symbol-value url-basic-auth-storage)))
(setcdr byserv
;; plist-put modify the same plist.
(setq creds
(plist-put creds :user
- (read-string (url-auth-user-prompt url realm)
- (or (plist-get creds :user)
- (user-real-login-name)))))
+ (and (url-interactive-p)
+ (read-string (url-auth-user-prompt url realm)
+ (or (plist-get creds :user)
+ (user-real-login-name))))))
(plist-put creds :secret
- (read-passwd "Password: " nil (plist-get creds :secret))))
+ (and (url-interactive-p)
+ (read-passwd "Password: " nil (plist-get creds :secret)))))
(defun url-digest-auth-directory-id-assoc (dirkey keylist)
"Find the best match for DIRKEY in key alist KEYLIST.
(cl-check-type url url "Need a pre-parsed URL.")
(let* (;; (host (url-host (or url-using-proxy url)))
;; (port (url-port (or url-using-proxy url)))
- (nsm-noninteractive (or url-request-noninteractive
- (and (boundp 'url-http-noninteractive)
- url-http-noninteractive)))
+ (nsm-noninteractive (not (url-interactive-p)))
;; The following binding is needed in url-open-stream, which
;; is called from url-http-find-free-connection.
(url-current-object url)
(url-queue-context-buffer job)
(current-buffer))
(let ((url-request-noninteractive t)
- (url-allow-non-local-files t)
- ;; This will disable querying the user for
- ;; credentials if one of the things we're fetching
- ;; in the background return a header requesting it.
- (url-request-extra-headers '(("Authorization" . ""))))
+ (url-allow-non-local-files t))
(url-retrieve (url-queue-url job)
#'url-queue-callback-function (list job)
(url-queue-silentp job)
This should be set, e.g. by mail user agents rendering HTML to avoid
`bugs' which call home.")
+(defun url-interactive-p ()
+ "Say whether the current request is from a interactive context."
+ (not (or url-request-noninteractive
+ (bound-and-true-p 'url-http-noninteractive))))
+
;; Obsolete
(defconst url-version "Emacs" "Version number of URL package.")