summaryrefslogtreecommitdiff
path: root/lisp/url
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/ChangeLog19
-rw-r--r--lisp/url/url-auth.el44
-rw-r--r--lisp/url/url-expand.el3
-rw-r--r--lisp/url/url-util.el20
4 files changed, 56 insertions, 30 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 0e4362bce31..8f3979debcf 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,8 +1,27 @@
+2007-10-13 Richard Stallman <rms@gnu.org>
+
+ * url-util.el (url-basepath): Function deleted.
+ (url-file-directory, url-file-nondirectory): New functions
+ replacing url-basepath. Callers changed.
+
+ * url-expand.el (url-default-expander): Use `url-file-directory'.
+
+ * url-auth.el (url-digest-auth, url-basic-auth):
+ Rename `path' to `file'. Use `url-file-directory'.
+
2007-10-12 Diane Murray <disumu@x3y2z1.net>
* url-auth.el (url-basic-auth): Set path to "/" when URL has an
empty string filename.
+2007-10-09 Richard Stallman <rms@gnu.org>
+
+ * url-parse.el (url-type, url-user, url-password, url-host)
+ (url-port, url-filename, url-target, url-attributes)
+ (url-fullness, url-set-type, url-set-user, url-set-password)
+ (url-set-host, url-set-port, url-set-filename, url-set-target)
+ (url-set-attributes, url-set-full): Change macros to defuns.
+
2007-09-26 Juanma Barranquero <lekktu@gmail.com>
* url-dav.el (top):
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index 60239ba76ac..98e351916c1 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -61,22 +61,22 @@ If optional argument PROMPT is non-nil, ask for the username/password
to use for the url and its descendants. If optional third argument
OVERWRITE is non-nil, overwrite the old username/password pair if it
is found in the assoc list. If REALM is specified, use that as the realm
-instead of the pathname inheritance method."
+instead of the filename inheritance method."
(let* ((href (if (stringp url)
(url-generic-parse-url url)
url))
(server (url-host href))
(port (url-port href))
- (path (url-filename href))
+ (file (url-filename href))
(user (url-user href))
(pass (url-password href))
byserv retval data)
(setq server (format "%s:%d" server port)
- path (cond
+ file (cond
(realm realm)
- ((string= "" path) "/")
- ((string-match "/$" path) path)
- (t (url-basepath path)))
+ ((string= "" file) "/")
+ ((string-match "/$" file) file)
+ (t (url-file-directory file)))
byserv (cdr-safe (assoc server
(symbol-value url-basic-auth-storage))))
(cond
@@ -86,21 +86,21 @@ instead of the pathname inheritance method."
pass (read-passwd "Password: " nil (or pass "")))
(set url-basic-auth-storage
(cons (list server
- (cons path
+ (cons file
(setq retval
(base64-encode-string
(format "%s:%s" user pass)))))
(symbol-value url-basic-auth-storage))))
(byserv
- (setq retval (cdr-safe (assoc path byserv)))
+ (setq retval (cdr-safe (assoc file byserv)))
(if (and (not retval)
- (string-match "/" path))
+ (string-match "/" file))
(while (and byserv (not retval))
(setq data (car (car byserv)))
(if (or (not (string-match "/" data)) ; It's a realm - take it!
(and
- (>= (length path) (length data))
- (string= data (substring path 0 (length data)))))
+ (>= (length file) (length data))
+ (string= data (substring file 0 (length data)))))
(setq retval (cdr (car byserv))))
(setq byserv (cdr byserv))))
(if (or (and (not retval) prompt) overwrite)
@@ -111,7 +111,7 @@ instead of the pathname inheritance method."
retval (base64-encode-string (format "%s:%s" user pass))
byserv (assoc server (symbol-value url-basic-auth-storage)))
(setcdr byserv
- (cons (cons path retval) (cdr byserv))))))
+ (cons (cons file retval) (cdr byserv))))))
(t (setq retval nil)))
(if retval (setq retval (concat "Basic " retval)))
retval))
@@ -153,12 +153,12 @@ instead of hostname:portnum."
url))
(server (url-host href))
(port (url-port href))
- (path (url-filename href))
+ (file (url-filename href))
user pass byserv retval data)
- (setq path (cond
+ (setq file (cond
(realm realm)
- ((string-match "/$" path) path)
- (t (url-basepath path)))
+ ((string-match "/$" file) file)
+ (t (url-file-directory file)))
server (format "%s:%d" server port)
byserv (cdr-safe (assoc server url-digest-auth-storage)))
(cond
@@ -168,7 +168,7 @@ instead of hostname:portnum."
pass (read-passwd "Password: ")
url-digest-auth-storage
(cons (list server
- (cons path
+ (cons file
(setq retval
(cons user
(url-digest-auth-create-key
@@ -177,15 +177,15 @@ instead of hostname:portnum."
url)))))
url-digest-auth-storage)))
(byserv
- (setq retval (cdr-safe (assoc path byserv)))
+ (setq retval (cdr-safe (assoc file byserv)))
(if (and (not retval) ; no exact match, check directories
- (string-match "/" path)) ; not looking for a realm
+ (string-match "/" file)) ; not looking for a realm
(while (and byserv (not retval))
(setq data (car (car byserv)))
(if (or (not (string-match "/" data))
(and
- (>= (length path) (length data))
- (string= data (substring path 0 (length data)))))
+ (>= (length file) (length data))
+ (string= data (substring file 0 (length data)))))
(setq retval (cdr (car byserv))))
(setq byserv (cdr byserv))))
(if (or (and (not retval) prompt) overwrite)
@@ -201,7 +201,7 @@ instead of hostname:portnum."
url)))
byserv (assoc server url-digest-auth-storage))
(setcdr byserv
- (cons (cons path retval) (cdr byserv))))))
+ (cons (cons file retval) (cdr byserv))))))
(t (setq retval nil)))
(if retval
(let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven"))
diff --git a/lisp/url/url-expand.el b/lisp/url/url-expand.el
index df4de29a619..bebdbd9e04b 100644
--- a/lisp/url/url-expand.el
+++ b/lisp/url/url-expand.el
@@ -135,7 +135,8 @@ path components followed by `..' are removed, along with the `..' itself."
sepchar (substring (url-filename urlobj) (match-beginning 0) (match-end 0)))
(setq file (url-filename urlobj)))
(setq file (url-expander-remove-relative-links
- (concat (url-basepath (url-filename defobj)) file)))
+ (expand-file-name file
+ (url-file-directory (url-filename defobj)))))
(setf (url-filename urlobj)
(if query (concat file sepchar query) file))))))
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 9f73fa435be..119f40b4da4 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -259,18 +259,24 @@ Will not do anything if `url-show-status' is nil."
(/ (* x 100) y)))
;;;###autoload
-(defun url-basepath (file &optional x)
- "Return the base pathname of FILE, or the actual filename if X is true."
+(defun url-file-directory (file)
+ "Return the directory part of FILE, for a URL."
(cond
((null file) "")
((string-match (eval-when-compile (regexp-quote "?")) file)
- (if x
- (file-name-nondirectory (substring file 0 (match-beginning 0)))
- (file-name-directory (substring file 0 (match-beginning 0)))))
- (x (file-name-nondirectory file))
+ (file-name-directory (substring file 0 (match-beginning 0))))
(t (file-name-directory file))))
;;;###autoload
+(defun url-file-nondirectory (file)
+ "Return the nondirectory part of FILE, for a URL."
+ (cond
+ ((null file) "")
+ ((string-match (eval-when-compile (regexp-quote "?")) file)
+ (file-name-nondirectory (substring file 0 (match-beginning 0))))
+ (t (file-name-nondirectory file))))
+
+;;;###autoload
(defun url-parse-query-string (query &optional downcase allow-newlines)
(let (retval pairs cur key val)
(setq pairs (split-string query "&"))
@@ -385,7 +391,7 @@ string: \"%\" followed by two lowercase hex digits."
If optional variable X is t,
then return the basename of the file with the extension stripped off."
(if (and fname
- (setq fname (url-basepath fname t))
+ (setq fname (url-file-nondirectory fname))
(string-match "\\.[^./]+$" fname))
(if x (substring fname 0 (match-beginning 0))
(substring fname (match-beginning 0) nil))