From a345ff6bf2af54db2ee03296965165127f7758ec Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sun, 23 Nov 2014 15:05:18 +0100 Subject: [PATCH] Implement a new url parameter `url-request-noninteractive' * url-http.el (url-http): Respect `url-request-noninteractive'. * url-queue.el (url-queue-start-retrieve): Fetching through url-queue should always be noninteractive. * url-vars.el (url-request-noninteractive): New variable. --- etc/ChangeLog | 4 ++++ etc/NEWS | 10 ++++++++-- lisp/url/ChangeLog | 9 +++++++++ lisp/url/url-http.el | 6 ++++++ lisp/url/url-queue.el | 9 +++++---- lisp/url/url-vars.el | 3 +++ 6 files changed, 35 insertions(+), 6 deletions(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index d57190fce0..867e4f5f09 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * NEWS: Mention `url-request-noninteractive'. + 2014-11-19 Leo Liu * NEWS: Mention new macro define-advice. diff --git a/etc/NEWS b/etc/NEWS index 769d2c6fd3..a88902a675 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -262,14 +262,20 @@ plain text parts, if display of HTML email is possible; customize the ** In sh-mode, you can now use `sh-shell' as a file-local variable to specify the type of shell in use (bash, csh, etc). -** The URL package accepts now the protocols "ssh", "scp" and "rsync". +** URL + +*** The URL package accepts now the protocols "ssh", "scp" and "rsync". When `url-handler-mode' is enabled, file operations for these protocols as well as for "telnet" and "ftp" are passed to Tramp. -** The URL package allows customizing the `url-user-agent' string. +*** The URL package allows customizing the `url-user-agent' string. The new `url-user-agent' variable can be customized to be a string or a function. +*** The new interface variable `url-request-noninteractive' can be used +to specify that we're running in a noninteractive context, and that +we should not be queried about things like TLS certificate validity. + ** Tramp *** New connection method "nc", which allows to access dumb busyboxes. diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 1be4ca70a8..7ba9de0f76 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,12 @@ +2014-11-23 Lars Magne Ingebrigtsen + + * url-http.el (url-http): Respect `url-request-noninteractive'. + + * url-queue.el (url-queue-start-retrieve): Fetching through + url-queue should always be noninteractive. + + * url-vars.el (url-request-noninteractive): New variable. + 2014-11-14 David Reitter * url-domsuf.el (url-domsuf-parse-file): Read compressed diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index a51785a512..1001c4dead 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -40,6 +40,7 @@ (defvar url-http-data) (defvar url-http-end-of-headers) (defvar url-http-extra-headers) +(defvar url-http-noninteractive) (defvar url-http-method) (defvar url-http-no-retry) (defvar url-http-process) @@ -1201,6 +1202,9 @@ overriding the value of `url-gateway-method'." (cl-check-type url vector "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))) (connection (url-http-find-free-connection host port gateway-method)) (buffer (or retry-buffer (generate-new-buffer @@ -1232,6 +1236,7 @@ overriding the value of `url-gateway-method'." url-http-process url-http-method url-http-extra-headers + url-http-noninteractive url-http-data url-http-target-url url-http-no-retry @@ -1241,6 +1246,7 @@ overriding the value of `url-gateway-method'." (setq url-http-method (or url-request-method "GET") url-http-extra-headers url-request-extra-headers + url-http-noninteractive url-request-noninteractive url-http-data url-request-data url-http-process connection url-http-chunked-length nil diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el index 87469b9103..9c4b402874 100644 --- a/lisp/url/url-queue.el +++ b/lisp/url/url-queue.el @@ -133,10 +133,11 @@ The variable `url-queue-timeout' sets a timeout." (defun url-queue-start-retrieve (job) (setf (url-queue-buffer job) (ignore-errors - (url-retrieve (url-queue-url job) - #'url-queue-callback-function (list job) - (url-queue-silentp job) - (url-queue-inhibit-cookiesp job))))) + (let ((url-request-noninteractive t)) + (url-retrieve (url-queue-url job) + #'url-queue-callback-function (list job) + (url-queue-silentp job) + (url-queue-inhibit-cookiesp job)))))) (defun url-queue-prune-old-entries () (let (dead-jobs) diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 62b7b85553..bc23b982f8 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el @@ -209,6 +209,9 @@ document." "A list of extra headers to send with the next request. Should be an assoc list of headers/contents.") +(defvar url-request-noninteractive nil + "If non-nil, the request is done in a noninteractive context.") + (defvar url-request-method nil "The method to use for the next request.") (defvar url-mime-encoding-string (and (fboundp 'zlib-available-p) -- 2.39.2