Qore WebDavHandler Module Reference 1.0
Loading...
Searching...
No Matches
FsWebDavHandler.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
2
3/* WebDavHandler module Copyright 2019 - 2022 Qore Technologies, s.r.o.
4
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 DEALINGS IN THE SOFTWARE.
22*/
23
24
26namespace WebDavHandler {
29
30public:
31protected:
33 string basePath;
34 bool debug;
35
37 const BlockSize = 32 * 1024;
38
40 const IoTimeout = 30s;
41
42public:
43
45
48 constructor(string path, *HttpServer::AbstractAuthenticator auth) ;
49
50
52
57 constructor(string path, *HttpServer::AbstractAuthenticator auth, string virtual_relative_path_base) ;
58
59
61
67 constructor(string path, *HttpServer::AbstractAuthenticator auth, AbstractWebDavPropertyHandler property_handler, string virtual_relative_path_base = "/")
68 ;
69
70
72
79 constructor(string path, *HttpServer::AbstractAuthenticator auth, Logger logger, AbstractWebDavPropertyHandler property_handler = new InMemoryWebDavPropertyHandler(), string virtual_relative_path_base = '/') ;
80
81
83protected:
84 init(string path);
85public:
86
87
89
91protected:
92 string getRealPath(string raw_path);
93public:
94
95
97protected:
98 *string getContentType(string filePath);
99public:
100
101
103protected:
104 hash<auto> hstat2Resource(string path, string displayname, hash<StatInfo> h);
105public:
106
107
109private:
110 list<hash<auto>> preparePropFindResponse(hash<auto> cx, string depth = 'infinity', hash<StatInfo> h, bool all_props, *hash<string, hash<string, bool>> additional_props);
111public:
112
113
114private:
115 string getETag(string path);
116public:
117
118
119private:
120 hash<HttpResponseInfo> internalGet(Socket s, hash<auto> cx, hash<auto> hdr, *data body, bool get = True);
121public:
122
123
124private:
125 *string getDirectoryList(string path);
126public:
127
128
130
164protected:
165 hash<HttpResponseInfo> handleGetImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
166public:
167
168
170
206protected:
207 hash<HttpResponseInfo> handleHeadImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
208public:
209
210
212
248protected:
249 hash<HttpResponseInfo> handlePostImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
250public:
251
252
254
288protected:
289 hash<HttpResponseInfo> handlePutImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
290public:
291
292
294
328protected:
329 hash<HttpResponseInfo> handleDeleteImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
330public:
331
332
334
368protected:
369 hash<HttpResponseInfo> handleCopyImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
370public:
371
372
374
408protected:
409 hash<HttpResponseInfo> handleMoveImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
410public:
411
412
414
448protected:
449 hash<HttpResponseInfo> handleLockImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
450public:
451
452
453protected:
454 string getLockToken();
455public:
456
457
459
493protected:
494 hash<HttpResponseInfo> handleUnlockImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
495public:
496
497
499
533protected:
534 hash<HttpResponseInfo> handleMkcolImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
535public:
536
537
539
574protected:
575 hash<HttpResponseInfo> handlePropfindImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
576public:
577
578
580
591protected:
592 *hash<string, hash<string, hash<string, bool>>> handleProppatchImpl(reference<string> href, hash<auto> cx, hash<auto> hdr, *hash<auto> request_xml, *list<hash<PropPatchActionInfo>> actions);
593public:
594
595
597protected:
598 *hash<string, hash<string, hash<string, bool>>> verifyPropertyUpdates(string path, *list<hash<PropPatchActionInfo>> actions);
599public:
600
601
603private:
604 hash<HttpResponseInfo> doCopyMoveIntern(Socket s, hash<auto> cx, hash<auto> hdr, *data body, bool copy_props);
605public:
606
607
609private:
610 internalCopyMove(Socket s, hash<auto> cx, hash<auto> hdr, *data body, bool copy_props);
611public:
612
613}; // class FsWebDavHandler
614}; // namespace WebDavHandler
Abstract WebDavHandler interface class.
Definition AbstractWebDavHandler.qc.dox.h:40
AbstractWebDavPropertyHandler property_handler
The property handler object.
Definition AbstractWebDavHandler.qc.dox.h:65
Logger logger
The Logger for this object.
Definition AbstractWebDavHandler.qc.dox.h:71
The abstract WebDavHandler property handler class interface.
Definition AbstractWebDavPropertyHandler.qc.dox.h:27
Filesystem WebDavHandler inteface class.
Definition FsWebDavHandler.qc.dox.h:28
hash< HttpResponseInfo > handleUnlockImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler UNLOCK requests for WebDavHandler resources.
const BlockSize
Default block size for chunked sends (32KiB)
Definition FsWebDavHandler.qc.dox.h:37
init(string path)
Common constructor initialization.
hash< HttpResponseInfo > handleLockImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler LOCK requests for WebDavHandler resources.
hash< HttpResponseInfo > handleHeadImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP HEAD requests for WebDavHandler resources.
constructor(string path, *HttpServer::AbstractAuthenticator auth)
Creates the object with an empty logger and an in-memory property handler.
hash< auto > hstat2Resource(string path, string displayname, hash< StatInfo > h)
Returns resources for use in a PROPFIND request based on a StatInfo hash.
const IoTimeout
Default I/O timeout.
Definition FsWebDavHandler.qc.dox.h:40
constructor(string path, *HttpServer::AbstractAuthenticator auth, string virtual_relative_path_base)
Creates the object with the given argument and an in-memory property handler.
string basePath
The root directory for serving files.
Definition FsWebDavHandler.qc.dox.h:33
hash< HttpResponseInfo > handlePostImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP POST requests for WebDavHandler resources.
hash< HttpResponseInfo > handleCopyImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler COPY requests for WebDavHandler resources.
*string getContentType(string filePath)
Returns the content type for the file based on its extension.
hash< HttpResponseInfo > handleMoveImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler MOVE requests for WebDavHandler resources.
*hash< string, hash< string, hash< string, bool > > > handleProppatchImpl(reference< string > href, hash< auto > cx, hash< auto > hdr, *hash< auto > request_xml, *list< hash< PropPatchActionInfo > > actions)
Internal method for handling PROPPATCH requests.
hash< HttpResponseInfo > handlePutImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP PUT requests for WebDavHandler resources.
hash< HttpResponseInfo > handleMkcolImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler MKCOL requests for WebDavHandler resources.
*hash< string, hash< string, hash< string, bool > > > verifyPropertyUpdates(string path, *list< hash< PropPatchActionInfo > > actions)
Verifies that all property updates can be performed before executing them.
list< hash< auto > > preparePropFindResponse(hash< auto > cx, string depth='infinity', hash< StatInfo > h, bool all_props, *hash< string, hash< string, bool > > additional_props)
Returns responses for each relevant resource.
hash< HttpResponseInfo > handleGetImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP GET requests for WebDavHandler resources.
constructor(string path, *HttpServer::AbstractAuthenticator auth, Logger logger, AbstractWebDavPropertyHandler property_handler=new InMemoryWebDavPropertyHandler(), string virtual_relative_path_base='/')
Creates the object with the given arguments.
constructor(string path, *HttpServer::AbstractAuthenticator auth, AbstractWebDavPropertyHandler property_handler, string virtual_relative_path_base="/")
Creates the object with the given arguments.
string getRealPath(string raw_path)
Converts a request path to a normalized real path on the filesystem in the root WebDavHandler directo...
internalCopyMove(Socket s, hash< auto > cx, hash< auto > hdr, *data body, bool copy_props)
Copy or move the file and any properties.
hash< HttpResponseInfo > handleDeleteImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP DELETE requests for WebDavHandler resources.
hash< HttpResponseInfo > doCopyMoveIntern(Socket s, hash< auto > cx, hash< auto > hdr, *data body, bool copy_props)
Process copy and moves (without deletion) internally including properties (properties are moved,...
hash< HttpResponseInfo > handlePropfindImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler PROPFIND requests for WebDavHandler resources; reetrieves properties from WebDa...
An in-memory property handler that stores and retrieves all properties in memory.
Definition InMemoryWebDavPropertyHandler.qc.dox.h:27
Main public WebDavHandler namespace.
Definition AbstractWebDavHandler.qc.dox.h:26