aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/url
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/ChangeLog24
-rw-r--r--lisp/url/url-cookie.el4
-rw-r--r--lisp/url/url-dav.el35
-rw-r--r--lisp/url/url-file.el8
-rw-r--r--lisp/url/url-handlers.el3
-rw-r--r--lisp/url/url-history.el4
-rw-r--r--lisp/url/url-http.el5
-rw-r--r--lisp/url/url.el31
8 files changed, 69 insertions, 45 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 546af477106..5718346b89b 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,27 @@
12005-06-14 Juanma Barranquero <lekktu@gmail.com>
2
3 * url-history.el (url-completion-function): Follow error
4 conventions.
5
62005-06-13 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * url-file.el (url-file, url-file-asynch-callback): with-current-buffer.
9
102005-06-10 Stefan Monnier <monnier@iro.umontreal.ca>
11
12 * url-dav.el: Remove most autoload cookies.
13 Don't hook into the url-file-handler since it currently breaks all
14 non-HTTP URLs.
15
16 * url-handlers.el (vc-registered): Explicitly disable VC for URL files.
17
18 * url.el (url-retrieve-synchronously): Don't exit precipitously when
19 fetching a file via ange-ftp.
20
212005-06-10 Juanma Barranquero <lekktu@gmail.com>
22
23 * url-cookie.el (url-cookie-multiple-line): Fix spelling in docstring.
24
12005-05-19 Juanma Barranquero <lekktu@gmail.com> 252005-05-19 Juanma Barranquero <lekktu@gmail.com>
2 26
3 * url-cookie.el (url-cookie-multiple-line): 27 * url-cookie.el (url-cookie-multiple-line):
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 328e60b63bc..7cee222c373 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -73,7 +73,7 @@
73 73
74(defvar url-cookie-storage nil "Where cookies are stored.") 74(defvar url-cookie-storage nil "Where cookies are stored.")
75(defvar url-cookie-secure-storage nil "Where secure cookies are stored.") 75(defvar url-cookie-secure-storage nil "Where secure cookies are stored.")
76(defcustom url-cookie-file nil "*Where cookies are stored on disk." 76(defcustom url-cookie-file nil "*Where cookies are stored on disk."
77 :type '(choice (const :tag "Default" :value nil) file) 77 :type '(choice (const :tag "Default" :value nil) file)
78 :group 'url-file 78 :group 'url-file
79 :group 'url-cookie) 79 :group 'url-cookie)
@@ -86,7 +86,7 @@
86(defcustom url-cookie-multiple-line nil 86(defcustom url-cookie-multiple-line nil
87 "*If nil, HTTP requests put all cookies for the server on one line. 87 "*If nil, HTTP requests put all cookies for the server on one line.
88Some web servers, such as http://www.hotmail.com/, only accept cookies 88Some web servers, such as http://www.hotmail.com/, only accept cookies
89when they are on one line. This is broken behaviour, but just try 89when they are on one line. This is broken behavior, but just try
90telling Microsoft that." 90telling Microsoft that."
91 :type 'boolean 91 :type 'boolean
92 :group 'url-cookie) 92 :group 'url-cookie)
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index a0f1ae1ebe7..a3320f88e96 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -457,7 +457,6 @@ added to this list, so most requests can just pass in nil."
457 "</" (symbol-name tag) ">\n")))) 457 "</" (symbol-name tag) ">\n"))))
458 (url-dav-process-response (url-retrieve-synchronously url) url))) 458 (url-dav-process-response (url-retrieve-synchronously url) url)))
459 459
460;;;###autoload
461(defun url-dav-get-properties (url &optional attributes depth namespaces) 460(defun url-dav-get-properties (url &optional attributes depth namespaces)
462 "Return properties for URL, up to DEPTH levels deep. 461 "Return properties for URL, up to DEPTH levels deep.
463 462
@@ -487,7 +486,6 @@ identify the owner of a LOCK when requesting it. This will be shown
487to other users when the DAV:lockdiscovery property is requested, so 486to other users when the DAV:lockdiscovery property is requested, so
488make sure you are comfortable with it leaking to the outside world.") 487make sure you are comfortable with it leaking to the outside world.")
489 488
490;;;###autoload
491(defun url-dav-lock-resource (url exclusive &optional depth) 489(defun url-dav-lock-resource (url exclusive &optional depth)
492 "Request a lock on URL. If EXCLUSIVE is non-nil, get an exclusive lock. 490 "Request a lock on URL. If EXCLUSIVE is non-nil, get an exclusive lock.
493Optional 3rd argument DEPTH says how deep the lock should go, default is 0 491Optional 3rd argument DEPTH says how deep the lock should go, default is 0
@@ -528,7 +526,6 @@ FAILURE-RESULTS is a list of (URL STATUS)."
528 (push (list url child-status) failures))) 526 (push (list url child-status) failures)))
529 (cons successes failures))) 527 (cons successes failures)))
530 528
531;;;###autoload
532(defun url-dav-active-locks (url &optional depth) 529(defun url-dav-active-locks (url &optional depth)
533 "Return an assoc list of all active locks on URL." 530 "Return an assoc list of all active locks on URL."
534 (let ((response (url-dav-get-properties url '(DAV:lockdiscovery) depth)) 531 (let ((response (url-dav-get-properties url '(DAV:lockdiscovery) depth))
@@ -563,7 +560,6 @@ FAILURE-RESULTS is a list of (URL STATUS)."
563 results))) 560 results)))
564 results)) 561 results))
565 562
566;;;###autoload
567(defun url-dav-unlock-resource (url lock-token) 563(defun url-dav-unlock-resource (url lock-token)
568 "Release the lock on URL represented by LOCK-TOKEN. 564 "Release the lock on URL represented by LOCK-TOKEN.
569Returns t iff the lock was successfully released." 565Returns t iff the lock was successfully released."
@@ -624,7 +620,6 @@ Returns t iff the lock was successfully released."
624 620
625(autoload 'url-http-head-file-attributes "url-http") 621(autoload 'url-http-head-file-attributes "url-http")
626 622
627;;;###autoload
628(defun url-dav-file-attributes (url &optional id-format) 623(defun url-dav-file-attributes (url &optional id-format)
629 (let ((properties (cdar (url-dav-get-properties url))) 624 (let ((properties (cdar (url-dav-get-properties url)))
630 (attributes nil)) 625 (attributes nil))
@@ -680,7 +675,6 @@ Returns t iff the lock was successfully released."
680 (setq attributes (url-http-head-file-attributes url id-format))) 675 (setq attributes (url-http-head-file-attributes url id-format)))
681 attributes)) 676 attributes))
682 677
683;;;###autoload
684(defun url-dav-save-resource (url obj &optional content-type lock-token) 678(defun url-dav-save-resource (url obj &optional content-type lock-token)
685 "Save OBJ as URL using WebDAV. 679 "Save OBJ as URL using WebDAV.
686URL must be a fully qualified URL. 680URL must be a fully qualified URL.
@@ -736,7 +730,6 @@ Use with care, and even then think three times.
736 (concat "(<" ,lock-token ">)")))))))) 730 (concat "(<" ,lock-token ">)"))))))))
737 731
738 732
739;;;###autoload
740(defun url-dav-delete-directory (url &optional recursive lock-token) 733(defun url-dav-delete-directory (url &optional recursive lock-token)
741 "Delete the WebDAV collection URL. 734 "Delete the WebDAV collection URL.
742If optional second argument RECURSIVE is non-nil, then delete all 735If optional second argument RECURSIVE is non-nil, then delete all
@@ -761,7 +754,6 @@ files in the collection as well."
761 props)) 754 props))
762 nil) 755 nil)
763 756
764;;;###autoload
765(defun url-dav-delete-file (url &optional lock-token) 757(defun url-dav-delete-file (url &optional lock-token)
766 "Delete file named URL." 758 "Delete file named URL."
767 (let ((props nil) 759 (let ((props nil)
@@ -781,7 +773,6 @@ files in the collection as well."
781 props)) 773 props))
782 nil) 774 nil)
783 775
784;;;###autoload
785(defun url-dav-directory-files (url &optional full match nosort files-only) 776(defun url-dav-directory-files (url &optional full match nosort files-only)
786 "Return a list of names of files in DIRECTORY. 777 "Return a list of names of files in DIRECTORY.
787There are three optional arguments: 778There are three optional arguments:
@@ -828,13 +819,11 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
828 files 819 files
829 (sort files 'string-lessp)))) 820 (sort files 'string-lessp))))
830 821
831;;;###autoload
832(defun url-dav-file-directory-p (url) 822(defun url-dav-file-directory-p (url)
833 "Return t if URL names an existing DAV collection." 823 "Return t if URL names an existing DAV collection."
834 (let ((properties (cdar (url-dav-get-properties url '(DAV:resourcetype))))) 824 (let ((properties (cdar (url-dav-get-properties url '(DAV:resourcetype)))))
835 (eq (plist-get properties 'DAV:resourcetype) 'DAV:collection))) 825 (eq (plist-get properties 'DAV:resourcetype) 'DAV:collection)))
836 826
837;;;###autoload
838(defun url-dav-make-directory (url &optional parents) 827(defun url-dav-make-directory (url &optional parents)
839 "Create the directory DIR and any nonexistent parent dirs." 828 "Create the directory DIR and any nonexistent parent dirs."
840 (declare (special url-http-response-status)) 829 (declare (special url-http-response-status))
@@ -864,7 +853,6 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
864 (kill-buffer buffer))) 853 (kill-buffer buffer)))
865 result)) 854 result))
866 855
867;;;###autoload
868(defun url-dav-rename-file (oldname newname &optional overwrite) 856(defun url-dav-rename-file (oldname newname &optional overwrite)
869 (if (not (and (string-match url-handler-regexp oldname) 857 (if (not (and (string-match url-handler-regexp oldname)
870 (string-match url-handler-regexp newname))) 858 (string-match url-handler-regexp newname)))
@@ -905,13 +893,11 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
905 props) 893 props)
906 t)) 894 t))
907 895
908;;;###autoload
909(defun url-dav-file-name-all-completions (file url) 896(defun url-dav-file-name-all-completions (file url)
910 "Return a list of all completions of file name FILE in directory DIRECTORY. 897 "Return a list of all completions of file name FILE in directory DIRECTORY.
911These are all file names in directory DIRECTORY which begin with FILE." 898These are all file names in directory DIRECTORY which begin with FILE."
912 (url-dav-directory-files url nil (concat "^" file ".*"))) 899 (url-dav-directory-files url nil (concat "^" file ".*")))
913 900
914;;;###autoload
915(defun url-dav-file-name-completion (file url) 901(defun url-dav-file-name-completion (file url)
916 "Complete file name FILE in directory DIRECTORY. 902 "Complete file name FILE in directory DIRECTORY.
917Returns the longest string 903Returns the longest string
@@ -951,15 +937,18 @@ Returns nil if DIR contains no name starting with FILE."
951 (put op 'url-file-handlers (intern-soft (format "url-dav-%s" op)))) 937 (put op 'url-file-handlers (intern-soft (format "url-dav-%s" op))))
952 938
953(mapcar 'url-dav-register-handler 939(mapcar 'url-dav-register-handler
954 '(file-name-all-completions 940 ;; These handlers are disabled because they incorrectly presume that
955 file-name-completion 941 ;; the URL specifies an HTTP location and thus break FTP URLs.
956 rename-file 942 '(;; file-name-all-completions
957 make-directory 943 ;; file-name-completion
958 file-directory-p 944 ;; rename-file
959 directory-files 945 ;; make-directory
960 delete-file 946 ;; file-directory-p
961 delete-directory 947 ;; directory-files
962 file-attributes)) 948 ;; delete-file
949 ;; delete-directory
950 ;; file-attributes
951 ))
963 952
964 953
965;;; Version Control backend cruft 954;;; Version Control backend cruft
diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el
index 0aa23acc0ec..c39d255304b 100644
--- a/lisp/url/url-file.el
+++ b/lisp/url/url-file.el
@@ -73,8 +73,7 @@ to them."
73 func args 73 func args
74 args efs)) 74 args efs))
75 (let ((size (nth 7 (file-attributes name)))) 75 (let ((size (nth 7 (file-attributes name))))
76 (save-excursion 76 (with-current-buffer buff
77 (set-buffer buff)
78 (goto-char (point-max)) 77 (goto-char (point-max))
79 (if (/= -1 size) 78 (if (/= -1 size)
80 (insert (format "Content-length: %d\n" size))) 79 (insert (format "Content-length: %d\n" size)))
@@ -177,9 +176,8 @@ to them."
177 (if (file-directory-p filename) 176 (if (file-directory-p filename)
178 ;; A directory is done the same whether we are local or remote 177 ;; A directory is done the same whether we are local or remote
179 (url-find-file-dired filename) 178 (url-find-file-dired filename)
180 (save-excursion 179 (with-current-buffer
181 (setq buffer (generate-new-buffer " *url-file*")) 180 (setq buffer (generate-new-buffer " *url-file*"))
182 (set-buffer buffer)
183 (mm-disable-multibyte) 181 (mm-disable-multibyte)
184 (setq url-current-object url) 182 (setq url-current-object url)
185 (insert "Content-type: " (or content-type "application/octet-stream") "\n") 183 (insert "Content-type: " (or content-type "application/octet-stream") "\n")
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 68bf0ec7ab5..12db63aade8 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -155,6 +155,9 @@ the arguments that would have been passed to OPERATION."
155;; These are operations that we do not support yet (DAV!!!) 155;; These are operations that we do not support yet (DAV!!!)
156(put 'file-writable-p 'url-file-handlers 'ignore) 156(put 'file-writable-p 'url-file-handlers 'ignore)
157(put 'file-symlink-p 'url-file-handlers 'ignore) 157(put 'file-symlink-p 'url-file-handlers 'ignore)
158;; Just like for ange-ftp: let's not waste time trying to look for RCS/foo,v
159;; files and such since we can't do anything clever with them anyway.
160(put 'vc-registered 'url-file-handlers 'ignore)
158 161
159(defun url-handler-expand-file-name (file &optional base) 162(defun url-handler-expand-file-name (file &optional base)
160 (if (file-name-absolute-p file) 163 (if (file-name-absolute-p file)
diff --git a/lisp/url/url-history.el b/lisp/url/url-history.el
index e2bc9b17f69..3f9a82b9afd 100644
--- a/lisp/url/url-history.el
+++ b/lisp/url/url-history.el
@@ -84,7 +84,7 @@ to run the `url-history-setup-save-timer' function manually."
84(defun url-history-setup-save-timer () 84(defun url-history-setup-save-timer ()
85 "Reset the history list timer." 85 "Reset the history list timer."
86 (interactive) 86 (interactive)
87 (ignore-errors 87 (ignore-errors
88 (cond ((fboundp 'cancel-timer) (cancel-timer url-history-timer)) 88 (cond ((fboundp 'cancel-timer) (cancel-timer url-history-timer))
89 ((fboundp 'delete-itimer) (delete-itimer url-history-timer)))) 89 ((fboundp 'delete-itimer) (delete-itimer url-history-timer))))
90 (setq url-history-timer nil) 90 (setq url-history-timer nil)
@@ -192,7 +192,7 @@ user for what type to save as."
192 (gethash string url-history-hash-table) 192 (gethash string url-history-hash-table)
193 t)) 193 t))
194 (t 194 (t
195 (error "url-completion-function very confused.")))) 195 (error "url-completion-function very confused"))))
196 196
197(provide 'url-history) 197(provide 'url-history)
198 198
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 16d51a0258c..f5bbf4a7bf4 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -500,7 +500,8 @@ should be shown to the user."
500 (url-request-data url-http-data) 500 (url-request-data url-http-data)
501 (url-request-extra-headers url-http-extra-headers)) 501 (url-request-extra-headers url-http-extra-headers))
502 (url-retrieve redirect-uri url-callback-function 502 (url-retrieve redirect-uri url-callback-function
503 url-callback-arguments) 503 (cons redirect-uri
504 (cdr url-callback-arguments)))
504 (url-mark-buffer-as-dead (current-buffer)))))) 505 (url-mark-buffer-as-dead (current-buffer))))))
505 (4 ; Client error 506 (4 ; Client error
506 ;; 400 Bad Request 507 ;; 400 Bad Request
@@ -849,7 +850,7 @@ the end of the document."
849 (url-display-percentage nil nil) 850 (url-display-percentage nil nil)
850 (goto-char (match-end 1)) 851 (goto-char (match-end 1))
851 (if (re-search-forward "^\r*$" nil t) 852 (if (re-search-forward "^\r*$" nil t)
852 (message "Saw end of trailers...")) 853 (url-http-debug "Saw end of trailers..."))
853 (if (url-http-parse-headers) 854 (if (url-http-parse-headers)
854 (url-http-activate-callback)))))))))) 855 (url-http-activate-callback))))))))))
855 856
diff --git a/lisp/url/url.el b/lisp/url/url.el
index 05ef85c9300..8b57d885949 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -170,17 +170,26 @@ no further processing). URL is either a string or a parsed URL."
170 (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer)) 170 (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer))
171 (setq retrieval-done t 171 (setq retrieval-done t
172 asynch-buffer (current-buffer))))) 172 asynch-buffer (current-buffer)))))
173 (let ((proc (and asynch-buffer (get-buffer-process asynch-buffer)))) 173 (if (null asynch-buffer)
174 (if (null proc) 174 ;; We do not need to do anything, it was a mailto or something
175 ;; We do not need to do anything, it was a mailto or something 175 ;; similar that takes processing completely outside of the URL
176 ;; similar that takes processing completely outside of the URL 176 ;; package.
177 ;; package. 177 nil
178 nil 178 (let ((proc (get-buffer-process asynch-buffer)))
179 ;; If the access method was synchronous, `retrieval-done' should
180 ;; hopefully already be set to t. If it is nil, and `proc' is also
181 ;; nil, it implies that the async process is not running in
182 ;; asynch-buffer. This happens e.g. for FTP files. In such a case
183 ;; url-file.el should probably set something like a `url-process'
184 ;; buffer-local variable so we can find the exact process that we
185 ;; should be waiting for. In the mean time, we'll just wait for any
186 ;; process output.
179 (while (not retrieval-done) 187 (while (not retrieval-done)
180 (url-debug 'retrieval 188 (url-debug 'retrieval
181 "Spinning in url-retrieve-synchronously: %S (%S)" 189 "Spinning in url-retrieve-synchronously: %S (%S)"
182 retrieval-done asynch-buffer) 190 retrieval-done asynch-buffer)
183 (if (memq (process-status proc) '(closed exit signal failed)) 191 (if (and proc (memq (process-status proc)
192 '(closed exit signal failed)))
184 ;; FIXME: It's not clear whether url-retrieve's callback is 193 ;; FIXME: It's not clear whether url-retrieve's callback is
185 ;; guaranteed to be called or not. It seems that url-http 194 ;; guaranteed to be called or not. It seems that url-http
186 ;; decides sometimes consciously not to call it, so it's not 195 ;; decides sometimes consciously not to call it, so it's not
@@ -193,7 +202,7 @@ no further processing). URL is either a string or a parsed URL."
193 ;; interrupt it before it got a chance to handle process input. 202 ;; interrupt it before it got a chance to handle process input.
194 ;; `sleep-for' was tried but it lead to other forms of 203 ;; `sleep-for' was tried but it lead to other forms of
195 ;; hanging. --Stef 204 ;; hanging. --Stef
196 (unless (accept-process-output proc) 205 (unless (or (accept-process-output proc) (null proc))
197 ;; accept-process-output returned nil, maybe because the process 206 ;; accept-process-output returned nil, maybe because the process
198 ;; exited (and may have been replaced with another). 207 ;; exited (and may have been replaced with another).
199 (setq proc (get-buffer-process asynch-buffer)))))) 208 (setq proc (get-buffer-process asynch-buffer))))))
@@ -201,9 +210,9 @@ no further processing). URL is either a string or a parsed URL."
201 210
202(defun url-mm-callback (&rest ignored) 211(defun url-mm-callback (&rest ignored)
203 (let ((handle (mm-dissect-buffer t))) 212 (let ((handle (mm-dissect-buffer t)))
204 (save-excursion 213 (url-mark-buffer-as-dead (current-buffer))
205 (url-mark-buffer-as-dead (current-buffer)) 214 (with-current-buffer
206 (set-buffer (generate-new-buffer (url-recreate-url url-current-object))) 215 (generate-new-buffer (url-recreate-url url-current-object))
207 (if (eq (mm-display-part handle) 'external) 216 (if (eq (mm-display-part handle) 'external)
208 (progn 217 (progn
209 (set-process-sentinel 218 (set-process-sentinel