]> code.delx.au - gnu-emacs/commitdiff
Implement a new url parameter `url-request-noninteractive'
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 23 Nov 2014 14:05:18 +0000 (15:05 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sun, 23 Nov 2014 14:05:18 +0000 (15:05 +0100)
* 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
etc/NEWS
lisp/url/ChangeLog
lisp/url/url-http.el
lisp/url/url-queue.el
lisp/url/url-vars.el

index d57190fce011055f473bdf1594e57ee344782fa2..867e4f5f09cebf2a184cea41dafbdaf3d803fda8 100644 (file)
@@ -1,3 +1,7 @@
+2014-11-23  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * NEWS: Mention `url-request-noninteractive'.
+
 2014-11-19  Leo Liu  <sdl.web@gmail.com>
 
        * NEWS: Mention new macro define-advice.
index 769d2c6fd3b8277c50f95a13ac93c47117349d63..a88902a675e7f5fd2d6d20e3ccdb83254f65dfcf 100644 (file)
--- 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.
index 1be4ca70a80f5002f0a2d9ae4a9bdeaf2ab55524..7ba9de0f761b2134d05154739696509c51ee040b 100644 (file)
@@ -1,3 +1,12 @@
+2014-11-23  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * 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  <david.reitter@gmail.com>
 
        * url-domsuf.el (url-domsuf-parse-file): Read compressed
index a51785a512970c9d5aeea9eba44f3805a15fae42..1001c4deadaa8640dad1927081c425909300024d 100644 (file)
@@ -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
index 87469b91032d1fd01ac8c58b92e4d2b99aa39b66..9c4b4028741c2f58e053e811e78a9fa89e1f4c05 100644 (file)
@@ -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)
index 62b7b855533cfe5d1af36e4118639e6b72b5ba0d..bc23b982f8231951f490f291f5d0d23dd507413e 100644 (file)
@@ -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)