Qore WebDavHandler Module Reference  1.0
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 
26 namespace WebDavHandler {
29 
30 public:
31 protected:
33  string basePath;
34  bool debug;
35 
37  const BlockSize = 32 * 1024;
38 
40  const IoTimeout = 30s;
41 
42 public:
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 
60 
62 
68 constructor(string path, *HttpServer::AbstractAuthenticator auth, AbstractWebDavPropertyHandler property_handler, string virtual_relative_path_base = '/') ;
69 
70 
72 
79 constructor(string path, *HttpServer::AbstractAuthenticator auth, Logger logger, AbstractWebDavPropertyHandler property_handler = new InMemoryWebDavPropertyHandler(), string virtual_relative_path_base = '/') ;
80 
81 
83 protected:
84  init(string path);
85 public:
86 
87 
89 
91 protected:
92  string getRealPath(string raw_path);
93 public:
94 
95 
97 protected:
98  *string getContentType(string filePath);
99 public:
100 
101 
103 protected:
104  hash<auto> hstat2Resource(string path, string displayname, hash<StatInfo> h);
105 public:
106 
107 
109 private:
110  list<hash<auto>> preparePropFindResponse(hash<auto> cx, string depth = 'infinity', hash<StatInfo> h, bool all_props, *hash<string, hash<string, bool>> additional_props);
111 public:
112 
113 
114 private:
115  string getETag(string path);
116 public:
117 
118 
119 private:
120  hash<HttpResponseInfo> internalGet(Socket s, hash<auto> cx, hash<auto> hdr, *data body, bool get = True);
121 public:
122 
123 
124 private:
125  *string getDirectoryList(string path);
126 public:
127 
128 
130 
164 protected:
165  hash<HttpResponseInfo> handleGetImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
166 public:
167 
168 
170 
206 protected:
207  hash<HttpResponseInfo> handleHeadImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
208 public:
209 
210 
212 
248 protected:
249  hash<HttpResponseInfo> handlePostImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
250 public:
251 
252 
254 
288 protected:
289  hash<HttpResponseInfo> handlePutImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
290 public:
291 
292 
294 
328 protected:
329  hash<HttpResponseInfo> handleDeleteImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
330 public:
331 
332 
334 
368 protected:
369  hash<HttpResponseInfo> handleCopyImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
370 public:
371 
372 
374 
408 protected:
409  hash<HttpResponseInfo> handleMoveImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
410 public:
411 
412 
414 
448 protected:
449  hash<HttpResponseInfo> handleLockImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
450 public:
451 
452 
453 protected:
454  string getLockToken();
455 public:
456 
457 
459 
493 protected:
494  hash<HttpResponseInfo> handleUnlockImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
495 public:
496 
497 
499 
533 protected:
534  hash<HttpResponseInfo> handleMkcolImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
535 public:
536 
537 
539 
574 protected:
575  hash<HttpResponseInfo> handlePropfindImpl(Socket s, hash<auto> cx, hash<auto> hdr, *data body);
576 public:
577 
578 
580 
591 protected:
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);
593 public:
594 
595 
597 protected:
598  *hash<string, hash<string, hash<string, bool>>> verifyPropertyUpdates(string path, *list<hash<PropPatchActionInfo>> actions);
599 public:
600 
601 
603 private:
604  hash<HttpResponseInfo> doCopyMoveIntern(Socket s, hash<auto> cx, hash<auto> hdr, *data body, bool copy_props);
605 public:
606 
607 
609 private:
610  internalCopyMove(Socket s, hash<auto> cx, hash<auto> hdr, *data body, bool copy_props);
611 public:
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
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 > 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< auto > hstat2Resource(string path, string displayname, hash< StatInfo > h)
Returns resources for use in a PROPFIND request based on a StatInfo hash.
const BlockSize
Default block size for chunked sends (32KiB)
Definition: FsWebDavHandler.qc.dox.h:37
init(string path)
Common constructor initialization.
hash< HttpResponseInfo > handleCopyImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler COPY requests for WebDavHandler resources.
hash< HttpResponseInfo > handlePropfindImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler PROPFIND requests for WebDavHandler resources; reetrieves properties from WebDa...
constructor(string path, *HttpServer::AbstractAuthenticator auth)
Creates the object with an empty logger and an in-memory property handler.
const IoTimeout
Default I/O timeout.
Definition: FsWebDavHandler.qc.dox.h:40
hash< HttpResponseInfo > handleUnlockImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler UNLOCK requests for WebDavHandler resources.
hash< HttpResponseInfo > handlePostImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP POST requests for WebDavHandler resources.
constructor(string path, *HttpServer::AbstractAuthenticator auth, string virtual_relative_path_base)
Creates the object with the given argument and an in-memory property handler.
*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.
hash< HttpResponseInfo > handlePutImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP PUT requests for WebDavHandler resources.
string basePath
The root directory for serving files.
Definition: FsWebDavHandler.qc.dox.h:33
constructor(string path, *HttpServer::AbstractAuthenticator auth, AbstractWebDavPropertyHandler property_handler, string virtual_relative_path_base='/')
Creates the object with the given arguments.
*string getContentType(string filePath)
Returns the content type for the file based on its extension.
hash< HttpResponseInfo > handleLockImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler LOCK requests for WebDavHandler resources.
hash< HttpResponseInfo > handleDeleteImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP DELETE 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< HttpResponseInfo > handleHeadImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP HEAD requests for WebDavHandler resources.
hash< HttpResponseInfo > handleMoveImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles WebDavHandler MOVE 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.
*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.
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 > handleGetImpl(Socket s, hash< auto > cx, hash< auto > hdr, *data body)
Handles HTTP GET requests for WebDavHandler resources.
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