1 The HTTP_WebDAV_Server class provides a framwork for the
2 implementation of customized WebDAV servers that can provide
3 filesystem like access to almost any kind of hierachically stored
6 The (abstract) server base class tries to encapsulate as much of
7 the protocol details as possible. It takes care of the needed WebDAV
8 header and XML payload parsing and generation (and knows about some
9 of the problems with common clients and tries hard to work around
12 WebDAV itself is an extension to the HTTP protocol. The HTTP
13 specific parts of it are already taken care of by the web server. Any
14 data needed by the server class is provided by the PHP SAPI interface
17 To create a working server from the base class you have to extend and
18 add methods for the actual access, modification and access control of
21 You may use the included HTTP_WebDAV_Server_Filesystem class as an
22 example of how to create a working server. This sample implementation
23 is used for testing the implementation of this package against the
24 litmus WebDAV compliance test suite.
25 (litmus is available on http://www.webdav.org/neon/litmus)
27 The methods you can add in your extended class are mostly named after
28 the WebDAV specific request methods (using upper case names). Methods
29 you may implement are:
31 * GET() get a resource from the server
32 * HEAD() get resource headers only from the server
33 * PUT() create or modify a resource on the server
34 * COPY() copy a resource on the server
35 * MOVE() move a resource on the server
36 * DELETE() delete a resource on the server
37 * MKCOL() create a new collection
38 * PROPFIND() get property data for a resource
39 * PROPPATCH() modify property data for a resource
40 * LOCK() lock a resource
41 * UNLOCK() unlock a locked resource
42 * checklock() check whether a resource is locked
43 * check_auth() check authentication
45 You can think of WebDAV resources as files, collections as directories
46 and properties as filesystem meta data (like size, creation date, ...).
48 The base class is able identify which of the methods you have
49 implemented and will create appropriate answers to OPTIONS requests
50 that ask for the WebDAV standards compliance level and the allowed
53 For a minimal working test server you need to implement GET(), PUT()
56 For a minimal (level 1) standards compliant server you also need to
57 implement MKCOL(), DELETE(), and PROPPATCH(). The COPY(), MOVE() and
58 HEAD() methods are emulated using GET(), PUT() and DELETE() if not
59 implemented, but for performance reasons you should better implement
62 For a complete (level 2) RFC2518 compliand server you also have to
63 provide locking support by implementing LOCK(), UNLOCK() and
66 Authentication is not really part of the WebDAV specification and
67 should be handled on the HTTP level. You can do so by means of, for
68 example, .htaccess files or similar services provided by your web
69 server. But you can also make use of the authentication features
70 offered by PHP by implementing the check_auth() method.
71 Using the check_auth() method you can create a dynamic interface
72 to any authentication system protecting the data you want to serve.
76 the following reference information may be outdated and/or
80 bool PROPINFO($options, &$files)
82 options[path] - Resource-Path
83 options[depth] - Depth of search requested: "0", "1", or "infinity"
84 options[props] - "all", "names", or an arry of requested properties
85 each property array element is either a string
86 (which implies the default "DAV:" namespace) or
87 an array with the two elements "name" and "xmlns"
88 for the properties name and XML namespace
90 &$files - storage array for property results with the following elements:
92 "files" -> array of found properties forresources. elements are:
94 "path" -> path of the resource
95 "props" -> properties array
96 each property array element is either a string
97 (which implies the default "DAV:" namespace) or
98 an array with the two elements "name" and "xmlns"
99 for the properties name and XML namespace
101 you should at least support the following
102 list of properties from the "DAV:" namespave:
104 - resourcetype: "collection" oder ""
105 - creationdate: unix-timestamp
106 - getcontentlength: integer
107 - getlastmodified: unix-timestamp
109 You may want to add support for these "DAV:"
112 - getcontenttype: mime-type
113 - displayname: string
115 for a compliant server you also have to be
116 able to return any property from other
117 namespaces that has been stored using
121 return-value: true / false
126 string MKCOL($option)
128 options[path] - path of the new collection to be created
131 HTTP status and status message, possible values are
134 * 405 Method not allowed
136 * 415 Unsupported media type
137 * 507 Insufficient Storage
138 (see also RFC2518 8.3.2)
143 string GET(&$options)
145 $options['path'] - path to the requested resource
146 $options['ranges'] - optional array of range specifications for
147 partial access. range specs are arrays that
148 consist of either a 'start' and 'end' element
149 (where 'end' can be empty to indicate a request
150 up to the actual end of the resource) or a
151 'last' element to access the last n bytes of
152 a resource without knowing its actual size in
155 Return-value: true bei Erfolg, false wenn not found
157 (TODO: andere stati berücksichtigen)
159 Content-Type, Content-Length header müssen von der Methode selbst
160 erzeugt werden (TODO: outdated)
167 options[path] - path to the requested resource
168 options[content_length] - size of request data in bytes
169 options[stream] - a PHP stream providing the input data
172 HTTP status, possible values are:
173 * 201 Created -> the resource did not exist before
174 and has been successfully created
175 * 204 No Content -> a previously existing resource has
176 successfully been modified
183 string COPY($options)
185 options[path] - path to the resource to be copied
186 options[depth] - "0" or "infinity" (applies only to directories)
187 options[overwrite] - true / false
188 options[dest] - path to the destination resource if local
189 options[dest_url] - non-local destination path
192 HTTP status, see RFC2518 8.8.5
198 string MOVE($options)
200 options[path] - path to the resource to be moved
201 options[overwrite] - true / false
202 options[dest] - path to the destination resource if local
203 options[dest_url] - non-local destination path
206 HTTP status, see RFC2518 8.9.4
211 string DELETE($options)
213 options[path] - path to the resource to be removed
216 HTTP status, see RFC2518 8.6.2
222 bool check_auth($type, $user, $passwd)
224 $type: HTTP-Auth type, i.A. "Basic"
226 $passwd: HTTP Passwort
228 return-value: true bei success, sonst false
229 (ToDo: array mit Auth-Type und Realm String zulassen bei fehler)