Make the URL library use records.

* lisp/url/url.el, lisp/url/url-cache.el, lisp/url/url-dav.el,
lisp/url/url-expand.el, lisp/url/url-file.el, lisp/url/url-imap.el,
lisp/url/url-ldap.el: Use `url-p' instead of `vectorp'.

* lisp/url/url-http.el (url-http): Check for type `url' instead of
`vector'.
This commit is contained in:
Lars Brinkhoff 2017-03-21 20:48:52 +01:00
parent 8e6f204f44
commit b6738682ae
8 changed files with 10 additions and 10 deletions

View file

@ -184,7 +184,7 @@ Very fast if you have an `md5' primitive function, suitably fast otherwise."
;; if it has been specified: e.g. http://www.example.com:80 will
;; be transcoded as http://www.example.com
(url-recreate-url
(if (vectorp url) url
(if (url-p url) url
(url-generic-parse-url url)))))
;;;###autoload

View file

@ -518,7 +518,7 @@ FAILURE-RESULTS is a list of (URL STATUS)."
depth '(("Timeout" . "Infinite"))))
;; Get the parent URL ready for expand-file-name
(if (not (vectorp url))
(if (not (url-p url))
(setq url (url-generic-parse-url url)))
;; Walk thru the response list, fully expand the URL, and grab the
@ -540,7 +540,7 @@ FAILURE-RESULTS is a list of (URL STATUS)."
(child-url nil)
(child-results nil)
(results nil))
(if (not (vectorp url))
(if (not (url-p url))
(setq url (url-generic-parse-url url)))
(while response

View file

@ -73,7 +73,7 @@ path components followed by `..' are removed, along with the `..' itself."
;; Need to figure out how/where to expand the fragment relative to
(setq default (cond
((vectorp default)
((url-p default)
;; Default URL has already been parsed
default)
(default

View file

@ -89,7 +89,7 @@ to them."
keep-date &optional msg cont nowait))
(defun url-file-build-filename (url)
(if (not (vectorp url))
(if (not (url-p url))
(setq url (url-generic-parse-url url)))
(let* ((user (url-user url))
(pass (url-password url))

View file

@ -1243,7 +1243,7 @@ Optional arg GATEWAY-METHOD specifies the gateway to be used,
overriding the value of `url-gateway-method'.
The return value of this function is the retrieval buffer."
(cl-check-type url vector "Need a pre-parsed URL.")
(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

View file

@ -50,7 +50,7 @@
(nnimap-authenticator ,authenticator)))))
(defun url-imap (url)
(unless (vectorp url)
(unless (url-p url)
(signal 'wrong-type-error (list "Need a pre-parsed URL." url)))
(with-current-buffer (generate-new-buffer " *url-imap*")
(mm-disable-multibyte)

View file

@ -115,11 +115,11 @@
(defun url-ldap (url)
"Perform an LDAP search specified by URL.
The return value is a buffer displaying the search results in HTML.
URL can be a URL string, or a URL vector of the type returned by
URL can be a URL string, or a URL record of the type returned by
`url-generic-parse-url'."
(if (stringp url)
(setq url (url-generic-parse-url (url-unhex-string url)))
(if (not (vectorp url))
(if (not (url-p url))
(error "Argument is not a valid URL")))
(with-current-buffer (generate-new-buffer " *url-ldap*")
(setq url-current-object url)

View file

@ -186,7 +186,7 @@ URL-encoded before it's used."
(when (stringp url)
(set-text-properties 0 (length url) nil url)
(setq url (url-encode-url url)))
(if (not (vectorp url))
(if (not (url-p url))
(setq url (url-generic-parse-url url)))
(if (not (functionp callback))
(error "Must provide a callback function to url-retrieve"))