1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 11:21:04 -08:00

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.
This commit is contained in:
Lars Ingebrigtsen 2017-09-13 20:10:51 +02:00
parent 4ab44f75d6
commit 6339807147
3 changed files with 10 additions and 3 deletions

View file

@ -24,6 +24,7 @@
;;; Code: ;;; Code:
(require 'url-vars) (require 'url-vars)
(require 'url-parse)
;; Fixme: support SSH explicitly or via a url-gateway-rlogin-program? ;; Fixme: support SSH explicitly or via a url-gateway-rlogin-program?
@ -245,8 +246,9 @@ overriding the value of `url-gateway-method'."
name buffer host service name buffer host service
:type gw-method :type gw-method
;; Use non-blocking socket if we can. ;; Use non-blocking socket if we can.
:nowait (featurep 'make-network-process :nowait (and (featurep 'make-network-process)
'(:nowait t)))) (url-asynchronous url-current-object)
'(:nowait t))))
(`socks (`socks
(socks-open-network-stream name buffer host service)) (socks-open-network-stream name buffer host service))
(`telnet (`telnet

View file

@ -36,7 +36,8 @@
target attributes fullness)) target attributes fullness))
(:copier nil)) (:copier nil))
type user password host portspec filename target attributes fullness type user password host portspec filename target attributes fullness
silent (use-cookies t)) silent (use-cookies t)
(asynchronous t))
(defsubst url-port (urlobj) (defsubst url-port (urlobj)
"Return the port number for the URL specified by URLOBJ. "Return the port number for the URL specified by URLOBJ.

View file

@ -119,6 +119,8 @@ variable in the original buffer as a forwarding pointer.")
(defvar url-retrieve-number-of-calls 0) (defvar url-retrieve-number-of-calls 0)
(autoload 'url-cache-prune-cache "url-cache") (autoload 'url-cache-prune-cache "url-cache")
(defvar url-asynchronous t
"Bind to nil before calling `url-retrieve' to signal :nowait connections.")
;;;###autoload ;;;###autoload
(defun url-retrieve (url callback &optional cbargs silent inhibit-cookies) (defun url-retrieve (url callback &optional cbargs silent inhibit-cookies)
@ -190,6 +192,7 @@ URL-encoded before it's used."
(unless (url-type url) (unless (url-type url)
(error "Bad url: %s" (url-recreate-url url))) (error "Bad url: %s" (url-recreate-url url)))
(setf (url-silent url) silent) (setf (url-silent url) silent)
(setf (url-asynchronous url) url-asynchronous)
(setf (url-use-cookies url) (not inhibit-cookies)) (setf (url-use-cookies url) (not inhibit-cookies))
;; Once in a while, remove old entries from the URL cache. ;; Once in a while, remove old entries from the URL cache.
(when (zerop (% url-retrieve-number-of-calls 1000)) (when (zerop (% url-retrieve-number-of-calls 1000))
@ -232,6 +235,7 @@ how long to wait for a response before giving up."
(let ((retrieval-done nil) (let ((retrieval-done nil)
(start-time (current-time)) (start-time (current-time))
(url-asynchronous nil)
(asynch-buffer nil)) (asynch-buffer nil))
(setq asynch-buffer (setq asynch-buffer
(url-retrieve url (lambda (&rest ignored) (url-retrieve url (lambda (&rest ignored)