;ELC   
;;; Compiled by aatharuv@cutter-john.mit.edu on Sun Jan  5 18:41:47 2003
;;; from file /afs/sipb.mit.edu/contrib/emacs/packages/url-cvs-20030105-src/lisp/url-dav.el
;;; in Emacs version 21.1.1
;;; with bytecomp version 2.85
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`url-dav.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\300\301!\210\300\302!\210\300\303!\207" [require xml url-util url-handlers] 2)
#@33 List of supported DAV versions.
(defvar url-dav-supported-protocols '(1 2) (#$ . 744))
(defalias 'url-dav-supported-p #[(url) "\302\303!\205 \304\305!\205 \306\307\310	!\311\"\"\207" [url-dav-supported-protocols url featurep xml fboundp xml-expand-namespace intersection plist-get url-http-options dav] 5])
#@46 Return the text data from the XML node NODE.
(defalias 'url-dav-node-text #[(node) "\302\303\211AA)\304#\207" [node x mapconcat #[(txt) ";\203 \207\301\207" [txt ""] 1] " "] 5 (#$ . 1060)])
(byte-code "\301B\302\301\207" [current-load-list url-dav-datatype-attribute urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/dt] 2)
(defalias 'url-dav-process-integer-property #[(node) "\301\302\303!!!\207" [node truncate string-to-number url-dav-node-text] 4])
(defalias 'url-dav-process-number-property #[(node) "\301\302!!\207" [node string-to-number url-dav-node-text] 3])
#@206 List of regular expressions matching iso8601 dates.
1st regular expression matches the date.
2nd regular expression matches the time.
3rd regular expression matches the (optional) timezone specification.

(defconst url-dav-iso8601-regexp (byte-code "\306\307\310\311\n\312\313\314R\315P		\260\f\260P\316Q\317P\316P\315PE.\207" [dash colon 4digit 2digit date-fullyear date-month "-?" ":?" "\\([0-9][0-9][0-9][0-9]\\)" "\\([0-9][0-9]\\)" "\\(\\.[0-9]+\\)?" "[-+]\\(" "\\):" "Z" "T" "^" date-mday time-hour time-minute time-second time-secfrac time-numoffset time-offset partial-time full-date full-time date-time] 6) (#$ . 1642))
(defalias 'url-dav-process-date-property #[(node) "\306\307!\210@A@\3108\311\f!\312\312\312\312\312 \312!\312\"\312#\312$\312%\312&\312'\313	#\203\301 \314\315\316\"!$\314\315\310\"!#\314\315\317\"!\"\320\225\313\n#\203\301 \314\315\316\"! \314\315\310\"!\314\315\317\"!\314\315\321\"\206\206 \322!!\320\225\313#\203\234 \315\316\"'\323\324\325'\203\250 \326\202\251 \327#\210 \"#$%&'\257	\204\313 \330!\203\332 \331\332\"\202\342 \323\324\333\f@$\210.\207" [url-dav-iso8601-regexp date-re time-re tz-re node date-string require parse-time 2 url-dav-node-text nil string-match string-to-int match-string 1 3 0 4 "0" url-debug dav "Parsed iso8601%s date" "tz" "" parse-time-string apply encode-time "Unable to decode date (%S) (%s)" re-start time seconds minute hour fractional-seconds day month year day-of-week dst tz] 9])
(defalias 'url-dav-process-boolean-property #[(node) "\301\302!!\303U?\207" [node string-to-int url-dav-node-text 0] 3])
(defalias 'url-dav-process-uri-property #[(node) "\301\302!!\207" [node url-generic-parse-url url-dav-node-text] 3])
#@45 Find a function to parse the XML node NODE.
(defalias 'url-dav-find-parser #[(node) "@\302N\206# \303\304\305@\"!\306	!\204 \307\202! \310@\302	#\210	)\207" [node fn dav-parser intern format "url-dav-process-%s" fboundp url-dav-node-text put] 4 (#$ . 3493)])
(defalias 'url-dav-dispatch-node '(macro . #[(node) "\301\302DE\207" [node funcall url-dav-find-parser] 3]))
(defalias 'url-dav-process-DAV:prop #[(node) "\211AA)\306\211\211\211\211\204 \307\310!\210\203\224 @\311A@\236\243\206- \312!\306\313>\203> \314!\202\204 \315=\203K \316!\202\204 \317>\203X \320!\202\204 \321=\203e \322!\202\204 \323=\203r \324!\202\204 \325=\204~ \326\327\330#\210\331!!\332\f@#A\211\204 \f-\207" [node x handler-func value props node-type nil error "No child nodes in DAV:prop" intern "unknown" (dateTime\.iso8601tz dateTime\.iso8601 dateTime\.tz dateTime\.rfc1123 dateTime date) url-dav-process-date-property int url-dav-process-integer-property (number float) url-dav-process-number-property boolean url-dav-process-boolean-property uri url-dav-process-uri-property unknown url-debug dav "Unknown data type in url-dav-process-prop: %s" url-dav-find-parser plist-put children url-dav-datatype-attribute] 6])
(defalias 'url-dav-process-DAV:supportedlock #[(node) "\211AA)\306\211\211\211\203Z @;\204S @@\307=\203S \310@\211AA)\236\311@\211AA)\236\203S \n\203S \211AA)@@\n\211AA)@@\211B\fBA\211\204 \f,\207" [node x type scope results children nil DAV:lockentry DAV:lockscope DAV:locktype] 5])
(defalias 'url-dav-process-subnode-property #[(node) "\302\303\304\305\211AA)\"\"\207" [node x delq nil mapcar car-safe] 6])
(byte-code "\300\301\302\"\210\300\303\304\"\210\300\305\304\"\210\300\306\304\"\210\300\307\302\"\210\300\310\311\"\210\300\312\311\"\210\300\313\314\"\210\300\315\314\"\207" [defalias url-dav-process-DAV:depth url-dav-process-integer-property url-dav-process-DAV:resourcetype url-dav-process-subnode-property url-dav-process-DAV:locktype url-dav-process-DAV:lockscope url-dav-process-DAV:getcontentlength url-dav-process-DAV:getlastmodified url-dav-process-date-property url-dav-process-DAV:creationdate url-dav-process-DAV:iscollection url-dav-process-boolean-property url-dav-process-DAV:ishidden] 3)
(defalias 'url-dav-process-DAV:locktoken #[(node) "\302\303\304\305\211AA)\"\"\207" [node x delq nil mapcar #[(n) ";\203 \207\301!!\207" [n url-dav-find-parser] 2]] 6])
(defalias 'url-dav-process-DAV:owner #[(node) "\302\303\304\305\211AA)\"\"\207" [node x delq nil mapcar #[(n) ";\203 \207\301!!\207" [n url-dav-find-parser] 2]] 6])
(defalias 'url-dav-process-DAV:activelock #[(node) "\211AA)\304\211\203( @<\203! @@\305@!@!B\nBA\211\204 \n*\207" [node x results children nil url-dav-find-parser] 4])
(defalias 'url-dav-process-DAV:lockdiscovery #[(node) "\211AA)\304\211\203, @;\204% @@\305=\203% \306@!@!\nBA\211\204 \n*\207" [node x results children nil DAV:activelock url-dav-find-parser] 3])
(defalias 'url-dav-process-DAV:status #[(node) "\302!\303\304	\"\203 \305\306\307	\"!\202 \310)\207" [node status url-dav-node-text string-match "\\`[ 	\n]*HTTP/[0-9.]+ \\([0-9]+\\)" string-to-int match-string 1 500] 4])
(defalias 'url-dav-process-DAV:propstat #[(node) "\211AA)\305\211\211\204 \306\307!\210\310\311\f\236!\311\f\236!\310\312\f\236!\312\f\236!\313\312\n#\211+\207" [node x status props children nil error "No child nodes in DAV:propstat" url-dav-find-parser DAV:prop DAV:status plist-put] 5])
(defalias 'url-dav-process-DAV:response #[(node) "\211AA)\305\211\211\204 \306\307!\210\310\f\236\311\f\236\211\204# \306\312!\210\204+ \306\313!\210\314!!\314\n!\n!\211+B\207" [node x href propstat children nil error "No child nodes in DAV:response" DAV:propstat DAV:href "No href in DAV:response" "No propstat in DAV:response" url-dav-find-parser] 4])
(defalias 'url-dav-process-DAV:multistatus #[(node) "\211AA)\304\211\203 \305@!@!\nBA\211\204 \n*\207" [node x results children nil url-dav-find-parser] 3])
#@156 Parses a WebDAV response from BUFFER, interpreting it relative to URL.

The buffer must have been retrieved by HTTP or HTTPS and contain an
XML document.

(defalias 'url-dav-process-response #[(buffer url) "\306\211\n\203+ \306\216\212\nq\210b\210\f\203* \307\310\"\204% \307\311\"\203* \312`d\"*	@@\313=\203= \314	@!	@!\202\\ \315\316\317#\210\314	@!	@!\320\321#)BC*\207" [overall-status tree buffer url-http-end-of-headers url-http-response-status url-http-content-type nil string-match "^text/xml" "^application/xml" xml-parse-region DAV:multistatus url-dav-find-parser url-debug dav "Got back singleton response for URL(%S)" plist-put DAV:status url properties] 4 (#$ . 7590)])
#@676 Performs WebDAV operation METHOD on URL.  Returns the parsed responses.
Automatically creates an XML request body if TAG is non-nil.
BODY is the XML document fragment to be enclosed by <TAG></TAG>.

DEPTH is how deep the request should propogate.  Default is 0, meaning
it should apply only to URL.  A negative number means to use
`Infinity' for the depth.  Not all WebDAV servers support this depth
though.

HEADERS is an assoc list of extra headers to send in the request.

NAMESPACES is an assoc list of (NAMESPACE . EXPANSION), and these are
added to the <TAG> element.  The DAV=DAV: namespace is automatically
added to this list, so most requests can just pass in nil.

(defalias 'url-dav-request #[(url method tag body &optional depth headers namespaces) "\206 \306\211\306W\203 \307\202 \310!\311\312	\"\204  \313	B\314B\315\nBB\f\205F \316\317\320!\321\322\323	\324#\325\326\320!\325\260\n\327\330!\"+\207" [depth namespaces headers url-request-extra-headers method url-request-method 0 "Infinity" int-to-string assoc "DAV" ("DAV" . "DAV:") "Depth" ("Content-type" . "text/xml") "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" "<" symbol-name " " mapconcat #[(ns) "\301@\302A\303\260\207" [ns "xmlns:" "='" "'"] 5] "\n    " ">\n" "</" url-dav-process-response url-retrieve-synchronously tag body url-request-data url] 11 (#$ . 8300)])
#@219 Return properties for URL, up to DEPTH levels deep.

Returns an assoc list, where the key is the filename (possibly a full
URI), and the value is a standard property list of DAV property
names (ie: DAV:resourcetype).

(defalias 'url-dav-get-properties #[(url &optional attributes depth namespaces) "\304\305\306	\203 \307\310	\311#\202 \312\n\313&\207" [url attributes depth namespaces url-dav-request "PROPFIND" DAV:propfind mapconcat #[(attr) "\301\302!\303Q\207" [attr "<DAV:prop><" symbol-name "/></DAV:prop>"] 3] "\n  " "  <DAV:allprop/>" nil] 8 (#$ . 9679)])
#@71 Return whether PROPERTIES was the result of a successful DAV request.
(defalias 'url-dav-http-success-p '(macro . #[(status) "\301\302\303\304BB\305BB\306BB\207" [status = / or (500) (100) (2)] 5 (#$ . 10256)]))
#@335 *URL used as contact information when creating locks in DAV.
This will be used as the contents of the DAV:owner/DAV:href tag to
identify the owner of a LOCK when requesting it.  This will be shown
to other users when the DAV:lockdiscovery property is requested, so
make sure you are comfortable with it leaking to the outside world.

(defvar url-dav-lock-identifier (concat "mailto:" user-mail-address) (#$ . -10476))
#@363 Request a lock on URL.  If EXCLUSIVE is non-nil, get an exclusive lock.
Optional 3rd argument DEPTH says how deep the lock should go, default is 0
(lock only the resource and none of its children).

Returns a cons-cell of (SUCCESSFUL-RESULTS . FAILURE-RESULTS).
SUCCESSFUL-RESULTS is a list of (URL STATUS locktoken).
FAILURE-RESULTS is a list of (URL STATUS).

(defalias 'url-dav-lock-resource #[(url exclusive &optional depth) "\203 \306\202	 \307\310\311\312\313\314	\315\316\260	\317\317\317\317\317\317\320 \321\322\n!\323&\324 !\204> \325 ! \203\203 \211A@\326\f\211A@ \"\327\f\330\"\206Z \331\211\206a \331\332\245\333U\203v  \334EB\202>  DB\202> .B\207" [exclusive url-dav-lock-identifier body response result child-url "<DAV:exclusive/>" "<DAV:shared/>" "  <DAV:lockscope>" "</DAV:lockscope>\n" "  <DAV:locktype> <DAV:write/> </DAV:locktype>\n" "  <DAV:owner>\n" "    <DAV:href>" "</DAV:href>\n" "  </DAV:owner>\n" nil url-dav-request "LOCK" DAV:lockinfo (("Timeout" . "Infinite")) vectorp url-generic-parse-url url-expand-file-name plist-get DAV:status 500 100 2 "huh" child-status failures successes url depth] 10 (#$ . 10901)])
#@50 Return an assoc list of all active locks on URL.
(defalias 'url-dav-active-locks #[(url &optional depth) "\306\307	#\310\211\211\211\211\311!\204 \312!\203\265 \211A@\211\211A@\310\313\314\"\2069 \315\316\245\317U\203\245 \313\320\"\211\203\245 \203\245 \321@\236\203\235 \321@\236A\322@\236A\211\310\211\203\234 @\310\211\203\222 @BBA\211\204| *A\211\204l ,\211A\210\202I \203 \323\f\"B\nB\202 \n.\207" [url depth results child-results child-url child url-dav-get-properties (DAV:lockdiscovery) nil vectorp url-generic-parse-url plist-get DAV:status 500 100 2 DAV:lockdiscovery DAV:locktoken DAV:owner url-expand-file-name properties response owners tokens token #1=#:--dolist-temp--46601 owner #2=#:--dolist-temp--46602] 7 (#$ . 12096)])
#@105 Release the lock on URL represented by LOCK-TOKEN.
Returns `t' iff the lock was successfully released.

(defalias 'url-dav-unlock-resource #[(url lock-token) "\306\307\310QBC\311\312\313\f!\312\203* \314\216\212q\210\206# \315\316\245\317U*-\207" [lock-token url-request-extra-headers url-request-method url-request-data url buffer "Lock-Token" "<" ">" "UNLOCK" nil url-retrieve-synchronously ((kill-buffer buffer)) 500 100 2 result url-http-response-status] 4 (#$ . 12918)])
(defalias 'url-dav-file-attributes-mode-string #[(properties) "\306\307\310\"\311\312\"\311\313\"\314\232\315\311\316\">\317\320%\n\2033 %\321\322I\210%\323\322I\210%\324\322I\210\203= %\325\326I\210\f\203S %\327\330I\210%\331\330I\210%\332\330I\210\203\230 @A	@\333=\203\216 	A\334=\203t %\335\336I\210\202S 	A\337=\203\204 %\340\336I\210\202S \341\342\343	A#\210\202S \341\342\344	@#\210\202S %.\207" [properties lock readable directory-p executable-p supported-locks make-string 10 45 plist-get DAV:supportedlock http://apache\.org/dav/props/executable "T" DAV:collection DAV:resourcetype t nil 1 114 4 7 0 100 3 120 6 9 DAV:write DAV:shared 5 119 DAV:exclusive 2 url-debug dav "Unrecognized DAV:lockscope (%S)" "Unrecognized DAV:locktype (%S)" modes] 7])
(defalias 'url-dav-file-attributes #[(url) "\304!\211@A)\305\211\203H \306\307\"\206 \310\311\245\312U\203H \313\306\314\">\205( \315\316\317\211\305\306\320\"\306\320\"\306\321\"\206< \317\322!\305\211\211\257\f\202L \323!\n*\207" [url x attributes properties url-dav-get-properties nil plist-get DAV:status 500 100 2 DAV:collection DAV:resourcetype t 1 0 DAV:getlastmodified DAV:getcontentlength url-dav-file-attributes-mode-string url-http-head-file-attributes] 13])
#@99 Save OBJ as URL using WebDAV.
URL must be a fully qualified URL.
OBJ may be a buffer or a string.
(defalias 'url-dav-save-resource #[(url obj &optional content-type lock-token) "\306\211\211\307\310!\203 \212q\210\311 )\202  ;\203 \202  \312\313!\2034 \314\315\316QBB\317\206; \320BB\321!\211\203Z \322\216\212q\210\206T \323\324\245\325U*\f-\207" [obj url-request-data url-request-method url-request-extra-headers result buffer nil "PUT" bufferp buffer-string error "Invalid object to url-dav-save-resource" "If" "(<" ">)" "Content-type" "application/octet-stream" url-retrieve-synchronously ((kill-buffer buffer)) 500 100 2 lock-token content-type url url-http-response-status] 7 (#$ . 14684)])
#@135 Delete the WebDAV collection URL.
If optional second argument RECURSIVE is non-nil, then delete all
files in the collection as well.

(defalias 'url-dav-delete-directory #[(url &optional recursive lock-token) "\305\211\211\306\n\307\310#\204 G\310U\204 \311\312\313\314\nE\"\210\315\n\316\305\211\317\f\2050 \320\321\f\322QBC&\323\324\"\210+\305\207" [props status url recursive lock-token nil url-dav-get-properties (DAV:getcontenttype) 1 signal file-error "Removing directory" "directory not empty" url-dav-request "DELETE" -1 "If" "(<" ">)" mapc #[(result) "\302A\303\"\211\206 \304\305\245\306U?\205 \307\310\311\312@	F\"\207" [result status plist-get DAV:status 500 100 2 signal file-error "Removing directory" "Errror removing"] 7]] 10 (#$ . 15416)])
#@24 Delete file named URL.
(defalias 'url-dav-delete-file #[(url &optional lock-token) "\305\211\306\n!\307	\211@A)\310\"\311=\203 \312\313\314\315\nE\"\210\316\n\317\305\211\320\f\205/ \321\322\f\323QBC&\324\325	\"\210*\305\207" [status props url x lock-token nil url-dav-get-properties plist-get DAV:resourcetype DAV:collection signal file-error "Removing old name" "is a collection" url-dav-request "DELETE" -1 "If" "(<" ">)" mapc #[(result) "\302A\303\"\211\206 \304\305\245\306U?\205 \307\310\311\312@	F\"\207" [result status plist-get DAV:status 500 100 2 signal file-error "Removing old name" "Errror removing"] 7]] 11 (#$ . 16195)])
#@410 Return a list of names of files in DIRECTORY.
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 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.

(defalias 'url-dav-directory-files #[(url &optional full match nosort files-only) "\306\307\310#\311\211\211\312!\211G\310U\203 \313\314\315\316E\"\210\203y \211A@\211\211A@\317\320\"\321=\203= \204 \322\f	\"\204M \fG\311O\323\324\f\"\203Y \f\325\326O\203f \323\f\"\203 \f\327\230\204 \f\230\204 \f\nB\202 \203\202 \n\202\206 \330\n\331\"-\207" [url parsed-url files child-props child-url properties url-dav-get-properties (DAV:resourcetype) 1 nil url-generic-parse-url signal file-error "Opening directory" "not a directory" plist-get DAV:resourcetype DAV:collection url-expand-file-name string-match "/$" 0 -1 "" sort string-lessp files-only full match nosort] 7 (#$ . 16851)])
#@51 Return t if URL names an existing DAV collection.
(defalias 'url-dav-file-directory-p #[(url) "\303\304\"\211@A)\305\n\306\")\307=\207" [url x properties url-dav-get-properties (DAV:resourcetype) plist-get DAV:resourcetype DAV:collection] 4 (#$ . 17983)])
#@59 Create the directory DIR and any nonexistent parent dirs.
(defalias 'url-dav-make-directory #[(url &optional parents) "\306\307\306\310!\306\f\203  \311\216\212\fq\210\f\312=\203 \313*-\207" [url-request-extra-headers url-request-method url-request-data url buffer result nil "MKCOL" url-retrieve-synchronously ((kill-buffer buffer)) 201 t url-http-response-status] 2 (#$ . 18248)])
(defalias 'url-dav-rename-file #[(oldname newname &optional overwrite) "\306	\"\203 \306\n\"\204 \307\310\311	\n$\210\312\312\312\313	!\314\n!\211\203D \203= \247\203D \315\316\317\n\"!\204D \307\320\321\nD\"\210\203M \322B\323\nBB\324	\325\312\211\203a \326\202b \327&\330\331\f\"\210-\332\207" [url-handler-regexp oldname newname headers props status string-match signal file-error "Cannot rename between different URL backends" nil url-dav-file-directory-p url-http-file-exists-p yes-or-no-p format "File %s already exists; rename to it anyway? " file-already-exists "File already exists" ("Overwrite" . "T") "Destination" url-dav-request "MOVE" -1 0 mapc #[(result) "\304A\305\"\211\206 \306\307\245\310U?\205 \311\312\313\n	F\"\207" [result status oldname newname plist-get DAV:status 500 100 2 signal file-error "Renaming"] 7] t directory-p exists-p overwrite] 8])
#@148 Return a list of all completions of file name FILE in directory DIRECTORY.
These are all file names in directory DIRECTORY which begin with FILE.

(defalias 'url-dav-file-name-all-completions #[(file url) "\302\303\304	\305Q#\207" [url file url-dav-directory-files nil "^" ".*"] 6 (#$ . 19550)])
#@254 Complete file name FILE in directory DIRECTORY.
Returns the longest string
common to all file names in DIRECTORY that start with FILE.
If there is only one and FILE matches it exactly, returns t.
Returns nil if DIR contains no name starting with FILE.

(defalias 'url-dav-file-name-completion #[(file url) "\306	\"\307\211\204 \307\202\210 G\310U\203! @\230\203! \311\202\210 \312\313\"G\311\307\211\203\201 @GW\203\201 \314@\315TOP\307\307\211\203m @\316\"\204d \311A\211\204U *\f\203y \307\211\2023 T\2021 @\315O,*\207" [file url result matches failed regexp url-dav-file-name-all-completions nil 1 t sort #[(a b) "G	GV\207" [a b] 2] "^" 0 string-match searching n potential #1=#:--dolist-temp--46603] 5 (#$ . 19854)])
(defalias 'url-dav-register-handler #[(op) "\301\302\303\304\305\"!#\207" [op put url-file-handlers intern-soft format "url-dav-%s"] 7])
(mapcar 'url-dav-register-handler '(file-name-all-completions file-name-completion rename-file make-directory file-directory-p directory-files delete-file delete-directory file-attributes))
(defalias 'url-dav-vc-registered #[(url) "\301\302\"\205 \303\304!\305\"\205 \306\307\305#\210\310\207" [url string-match "\\`https?" plist-get url-http-options dav vc-file-setprop vc-backend t] 4])
(provide 'url-dav)
