emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/url/url-parse.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/url/url-parse.el,v
Date: Sun, 15 Apr 2007 16:47:20 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      07/04/15 16:47:20

Index: url-parse.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/url/url-parse.el,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- url-parse.el        21 Jan 2007 03:24:41 -0000      1.15
+++ url-parse.el        15 Apr 2007 16:47:20 -0000      1.16
@@ -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 "^\\(address@hidden)@" 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)))
-
-       ;; 3.5. Fragment
-       (when (looking-at "#")
-         (forward-char 1)
-         (setq refs (buffer-substring (point) (point-max))))
+         (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))))
 
+       (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))))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]