summaryrefslogtreecommitdiff
path: root/lisp/url/url.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-05-09 16:33:48 +0800
committerChong Yidong <cyd@gnu.org>2012-05-09 16:33:48 +0800
commitce7b18ec41c5102f4af27ec22cf873a75f510630 (patch)
tree7608fccb83f4887f7e95f925b2ee36cd4f78be7d /lisp/url/url.el
parent66b03a53a3218479b93d64857a08b6d4cb5a0f7f (diff)
downloademacs-ce7b18ec41c5102f4af27ec22cf873a75f510630.tar.gz
Improve RFC 3986 conformance of url package.
Fix 2012-04-10 change to url.el. * url-http.el (url-http-create-request): Ignore obsolete attributes slot of url-object. * url-parse.el: Improve RFC 3986 conformance. (url-generic-parse-url): Do not populate the ATTRIBUTES slot, since this is not reliable for general RFC 3986 URIs. Keep the whole path and query inside the FILENAME slot. Improve docstring. (url-recreate-url-attributes): Mark as obsolete. (url-recreate-url): Handle missing scheme and userinfo. * url-util.el (url-encode-url): New function for URL quoting. (url-encoding-table, url-host-allowed-chars) (url-path-allowed-chars): New constants. (url--allowed-chars): New helper function. (url-hexify-string): Use them. * url-vars.el (url-nonrelative-link): Make the regexp stricter. * url.el (url-retrieve-internal): Use url-encode-url. Fixes: debbugs:7017
Diffstat (limited to 'lisp/url/url.el')
-rw-r--r--lisp/url/url.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/lisp/url/url.el b/lisp/url/url.el
index 7884882c6e7..6d276273c2d 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -125,7 +125,9 @@ variable in the original buffer as a forwarding pointer.")
;;;###autoload
(defun url-retrieve (url callback &optional cbargs silent inhibit-cookies)
"Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
-URL is either a string or a parsed URL.
+URL is either a string or a parsed URL. If it is a string
+containing characters that are not valid in a URI, those
+characters are percent-encoded; see `url-encode-url'.
CALLBACK is called when the object has been completely retrieved, with
the current buffer containing the object, and any MIME headers associated
@@ -179,10 +181,8 @@ URL-encoded before it's used."
(url-do-setup)
(url-gc-dead-buffers)
(if (stringp url)
- (set-text-properties 0 (length url) nil url))
- (when (multibyte-string-p url)
- (let ((url-unreserved-chars (append '(?: ?/) url-unreserved-chars)))
- (setq url (url-hexify-string url))))
+ (set-text-properties 0 (length url) nil url))
+ (setq url (url-encode-url url))
(if (not (vectorp url))
(setq url (url-generic-parse-url url)))
(if (not (functionp callback))