# HG changeset patch # User Chong Yidong # Date 1176655640 0 # Node ID 4368e2079b5c3a0047ea1010e14fd3c9ac860880 # Parent bc69e2345f6bf3a398f964c87e9f977ba203c9b6 (url-generic-parse-url): Revert 2006-10-09 changes. diff -r bc69e2345f6b -r 4368e2079b5c lisp/url/url-parse.el --- a/lisp/url/url-parse.el Sun Apr 15 16:47:08 2007 +0000 +++ b/lisp/url/url-parse.el Sun Apr 15 16:47:20 2007 +0000 @@ -108,7 +108,7 @@ (defun url-recreate-url-attributes (urlobj) "Recreate the attributes of an URL string from the parsed URLOBJ." (when (url-attributes urlobj) - (concat "?" + (concat ";" (mapconcat (lambda (x) (if (cdr x) (concat (car x) "=" (cdr x)) @@ -168,7 +168,7 @@ (setq full t) (forward-char 2) (setq save-pos (point)) - (skip-chars-forward "^/\\?#") + (skip-chars-forward "^/") (setq host (buffer-substring save-pos (point))) (if (string-match "^\\([^@]+\\)@" host) (setq user (match-string 1 host) @@ -189,25 +189,29 @@ (setq port (url-scheme-get-property prot 'default-port))) ;; 3.3. Path + ;; Gross hack to preserve ';' in data URLs (setq save-pos (point)) - (skip-chars-forward "^#?") - (setq file (buffer-substring save-pos (point))) ;; 3.4. Query - (when (looking-at "\\?") - (forward-char 1) - (setq save-pos (point)) + (if (string= "data" prot) + (goto-char (point-max)) + ;; Now check for references (skip-chars-forward "^#") - ;; RFC 3986 specifies no general way of parsing the query - ;; string, but `url-parse-args' seems universal enough. - (setq attr (url-parse-args (buffer-substring save-pos (point)) t) - attr (nreverse attr))) + (if (eobp) + nil + (delete-region + (point) + (progn + (skip-chars-forward "#") + (setq refs (buffer-substring (point) (point-max))) + (point-max)))) + (goto-char save-pos) + (skip-chars-forward "^;") + (if (not (eobp)) + (setq attr (url-parse-args (buffer-substring (point) (point-max)) t) + attr (nreverse attr)))) - ;; 3.5. Fragment - (when (looking-at "#") - (forward-char 1) - (setq refs (buffer-substring (point) (point-max)))) - + (setq file (buffer-substring save-pos (point))) (if (and host (string-match "%[0-9][0-9]" host)) (setq host (url-unhex-string host))) (vector prot user pass host port file refs attr full))))))