diff options
| author | Lars Ingebrigtsen | 2017-09-13 20:10:51 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2017-09-13 20:11:02 +0200 |
| commit | 63398071471f6cd6b006d3c35d2d83c597549e4a (patch) | |
| tree | 2bfcc3ed4f1770dc1a5312b04a63082632f53fb2 | |
| parent | 4ab44f75d6ad7eb378c85c111ea1006076cf994b (diff) | |
| download | emacs-63398071471f6cd6b006d3c35d2d83c597549e4a.tar.gz emacs-63398071471f6cd6b006d3c35d2d83c597549e4a.zip | |
Make gnutls-verify-error work again with url-retrieve-synchronously
* lisp/url/url-gw.el (url-open-stream): Only use :nowait if
we're doing async connections (bug#26835).
* lisp/url/url-parse.el (url): Add an asynchronous slot.
* lisp/url/url.el (url-asynchronous): New variable.
(url-retrieve-internal): Store the value.
(url-retrieve-synchronously): Bind the variable.
| -rw-r--r-- | lisp/url/url-gw.el | 6 | ||||
| -rw-r--r-- | lisp/url/url-parse.el | 3 | ||||
| -rw-r--r-- | lisp/url/url.el | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el index 28acde64203..716b7c0a6e0 100644 --- a/lisp/url/url-gw.el +++ b/lisp/url/url-gw.el | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (require 'url-vars) | 26 | (require 'url-vars) |
| 27 | (require 'url-parse) | ||
| 27 | 28 | ||
| 28 | ;; Fixme: support SSH explicitly or via a url-gateway-rlogin-program? | 29 | ;; Fixme: support SSH explicitly or via a url-gateway-rlogin-program? |
| 29 | 30 | ||
| @@ -245,8 +246,9 @@ overriding the value of `url-gateway-method'." | |||
| 245 | name buffer host service | 246 | name buffer host service |
| 246 | :type gw-method | 247 | :type gw-method |
| 247 | ;; Use non-blocking socket if we can. | 248 | ;; Use non-blocking socket if we can. |
| 248 | :nowait (featurep 'make-network-process | 249 | :nowait (and (featurep 'make-network-process) |
| 249 | '(:nowait t)))) | 250 | (url-asynchronous url-current-object) |
| 251 | '(:nowait t)))) | ||
| 250 | (`socks | 252 | (`socks |
| 251 | (socks-open-network-stream name buffer host service)) | 253 | (socks-open-network-stream name buffer host service)) |
| 252 | (`telnet | 254 | (`telnet |
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el index 4738163f0bc..ef8e17dd13d 100644 --- a/lisp/url/url-parse.el +++ b/lisp/url/url-parse.el | |||
| @@ -36,7 +36,8 @@ | |||
| 36 | target attributes fullness)) | 36 | target attributes fullness)) |
| 37 | (:copier nil)) | 37 | (:copier nil)) |
| 38 | type user password host portspec filename target attributes fullness | 38 | type user password host portspec filename target attributes fullness |
| 39 | silent (use-cookies t)) | 39 | silent (use-cookies t) |
| 40 | (asynchronous t)) | ||
| 40 | 41 | ||
| 41 | (defsubst url-port (urlobj) | 42 | (defsubst url-port (urlobj) |
| 42 | "Return the port number for the URL specified by URLOBJ. | 43 | "Return the port number for the URL specified by URLOBJ. |
diff --git a/lisp/url/url.el b/lisp/url/url.el index be6377ceb3a..a6145d3f5f3 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el | |||
| @@ -119,6 +119,8 @@ variable in the original buffer as a forwarding pointer.") | |||
| 119 | 119 | ||
| 120 | (defvar url-retrieve-number-of-calls 0) | 120 | (defvar url-retrieve-number-of-calls 0) |
| 121 | (autoload 'url-cache-prune-cache "url-cache") | 121 | (autoload 'url-cache-prune-cache "url-cache") |
| 122 | (defvar url-asynchronous t | ||
| 123 | "Bind to nil before calling `url-retrieve' to signal :nowait connections.") | ||
| 122 | 124 | ||
| 123 | ;;;###autoload | 125 | ;;;###autoload |
| 124 | (defun url-retrieve (url callback &optional cbargs silent inhibit-cookies) | 126 | (defun url-retrieve (url callback &optional cbargs silent inhibit-cookies) |
| @@ -190,6 +192,7 @@ URL-encoded before it's used." | |||
| 190 | (unless (url-type url) | 192 | (unless (url-type url) |
| 191 | (error "Bad url: %s" (url-recreate-url url))) | 193 | (error "Bad url: %s" (url-recreate-url url))) |
| 192 | (setf (url-silent url) silent) | 194 | (setf (url-silent url) silent) |
| 195 | (setf (url-asynchronous url) url-asynchronous) | ||
| 193 | (setf (url-use-cookies url) (not inhibit-cookies)) | 196 | (setf (url-use-cookies url) (not inhibit-cookies)) |
| 194 | ;; Once in a while, remove old entries from the URL cache. | 197 | ;; Once in a while, remove old entries from the URL cache. |
| 195 | (when (zerop (% url-retrieve-number-of-calls 1000)) | 198 | (when (zerop (% url-retrieve-number-of-calls 1000)) |
| @@ -232,6 +235,7 @@ how long to wait for a response before giving up." | |||
| 232 | 235 | ||
| 233 | (let ((retrieval-done nil) | 236 | (let ((retrieval-done nil) |
| 234 | (start-time (current-time)) | 237 | (start-time (current-time)) |
| 238 | (url-asynchronous nil) | ||
| 235 | (asynch-buffer nil)) | 239 | (asynch-buffer nil)) |
| 236 | (setq asynch-buffer | 240 | (setq asynch-buffer |
| 237 | (url-retrieve url (lambda (&rest ignored) | 241 | (url-retrieve url (lambda (&rest ignored) |