[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109245: Fix various issues with url-
From: |
David Engster |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109245: Fix various issues with url-dav package (Bug#11916). |
Date: |
Sat, 28 Jul 2012 13:07:17 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109245
committer: David Engster <address@hidden>
branch nick: trunk
timestamp: Sat 2012-07-28 13:07:17 +0200
message:
Fix various issues with url-dav package (Bug#11916).
* url-dav.el (url-dav-supported-p): Added doc-string and remove
check for feature `xml' and function `xml-expand-namespace' which
never existed in Emacs proper.
(url-dav-process-response): Remove all indentation and newlines
from XML before parsing. Change call to `xml-parse-region' to do
namespace expansion with simple qualified names (Bug#11916).
(url-dav-request): Add autoload.
(url-dav-directory-files): Properly deal with empty directories.
Unhex URL before generating relative URLs.
(url-dav-file-directory-p): Fix check for 'DAV:collection.
modified:
lisp/url/ChangeLog
lisp/url/url-dav.el
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog 2012-07-14 02:08:32 +0000
+++ b/lisp/url/ChangeLog 2012-07-28 11:07:17 +0000
@@ -1,3 +1,16 @@
+2012-07-28 David Engster <address@hidden>
+
+ * url-dav.el (url-dav-supported-p): Added doc-string and remove
+ check for feature `xml' and function `xml-expand-namespace' which
+ never existed in Emacs proper.
+ (url-dav-process-response): Remove all indentation and newlines
+ from XML before parsing. Change call to `xml-parse-region' to do
+ namespace expansion with simple qualified names (Bug#11916).
+ (url-dav-request): Add autoload.
+ (url-dav-directory-files): Properly deal with empty directories.
+ Unhex URL before generating relative URLs.
+ (url-dav-file-directory-p): Fix check for 'DAV:collection.
+
2012-07-11 Stefan Monnier <address@hidden>
* url.el, url-queue.el, url-parse.el, url-http.el, url-future.el:
=== modified file 'lisp/url/url-dav.el'
--- a/lisp/url/url-dav.el 2012-07-11 23:13:41 +0000
+++ b/lisp/url/url-dav.el 2012-07-28 11:07:17 +0000
@@ -53,10 +53,10 @@
;;;###autoload
(defun url-dav-supported-p (url)
- (and (featurep 'xml)
- (fboundp 'xml-expand-namespace)
- (url-intersection url-dav-supported-protocols
- (plist-get (url-http-options url) 'dav))))
+ "Return WebDAV protocol version supported by URL.
+Returns nil if WebDAV is not supported."
+ (url-intersection url-dav-supported-protocols
+ (plist-get (url-http-options url) 'dav)))
(defun url-dav-node-text (node)
"Return the text data from the XML node NODE."
@@ -385,7 +385,12 @@
(when buffer
(unwind-protect
(with-current-buffer buffer
+ ;; First remove all indentation and line endings
(goto-char url-http-end-of-headers)
+ (indent-rigidly (point) (point-max) -1000)
+ (save-excursion
+ (while (re-search-forward "\r?\n" nil t)
+ (replace-match "")))
(setq overall-status url-http-response-status)
;; XML documents can be transferred as either text/xml or
@@ -395,7 +400,7 @@
url-http-content-type
(string-match "\\`\\(text\\|application\\)/xml"
url-http-content-type))
- (setq tree (xml-parse-region (point) (point-max)))))
+ (setq tree (xml-parse-region (point) (point-max) nil nil
'symbol-qnames))))
;; Clean up after ourselves.
(kill-buffer buffer)))
@@ -411,6 +416,7 @@
;; nobody but us needs to know the difference.
(list (cons url properties))))))
+;;;###autoload
(defun url-dav-request (url method tag body
&optional depth headers namespaces)
"Perform WebDAV operation METHOD on URL. Return the parsed responses.
@@ -768,8 +774,8 @@
(defun url-dav-directory-files (url &optional full match nosort files-only)
"Return a list of names of files in URL.
There are three optional arguments:
-If FULL is non-nil, return absolute file names. Otherwise return names
- that are relative to the specified directory.
+If FULL is non-nil, return absolute URLs. Otherwise return names
+ that are relative to the specified URL.
If MATCH is non-nil, mention only file names that match the regexp MATCH.
If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
NOSORT is useful if you plan to sort the result yourself."
@@ -779,8 +785,9 @@
(files nil)
(parsed-url (url-generic-parse-url url)))
- (if (= (length properties) 1)
- (signal 'file-error (list "Opening directory" "not a directory" url)))
+ (when (and (= (length properties) 1)
+ (not (url-dav-file-directory-p url)))
+ (signal 'file-error (list "Opening directory" "not a directory" url)))
(while properties
(setq child-props (pop properties)
@@ -794,7 +801,9 @@
;; are not supposed to return fully-qualified names.
(setq child-url (url-expand-file-name child-url parsed-url))
(if (not full)
- (setq child-url (substring child-url (length url))))
+ ;; Parts of the URL might be hex'ed.
+ (setq child-url (substring (url-unhex-string child-url)
+ (length url))))
;; We don't want '/' as the last character in filenames...
(if (string-match "/$" child-url)
@@ -814,7 +823,8 @@
(defun url-dav-file-directory-p (url)
"Return t if URL names an existing DAV collection."
(let ((properties (cdar (url-dav-get-properties url '(DAV:resourcetype)))))
- (eq (plist-get properties 'DAV:resourcetype) 'DAV:collection)))
+ (when (member 'DAV:collection (plist-get properties 'DAV:resourcetype))
+ t)))
(defun url-dav-make-directory (url &optional parents)
"Create the directory DIR and any nonexistent parent dirs."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109245: Fix various issues with url-dav package (Bug#11916).,
David Engster <=