"key": "/etc/apache2/ssl/server.key",
"pidfile": "/var/run/calypso.pid",
"user_principal": "/+%(user)s",
+ "base_prefix": "/",
},
"encoding": {
"request": "utf-8",
def data_root():
return os.path.expanduser(config.get("storage", "folder"))
+
+#
+# Return the base path for the web server.
+#
+
+def base_prefix():
+ return config.get("server", "base_prefix").rstrip("/")
+
#
# Given a URL, convert it to an absolute path name by
# prepending the storage folder name
#
def url_to_file(url):
+ if url.startswith(base_prefix()):
+ url = "/" + url[len(base_prefix()):].lstrip("/")
tail = urllib.url2pathname(url.strip("/"))
# eliminate .. components, and potential double leading slashes
tail = posixpath.normpath('/' + tail).lstrip('/')
file = os.path.join(data_root(), tail)
return file
+
#
# Does the provided URL reference a collection? This
# is done by seeing if the resulting path is a directory
# current user principal; path to the default collection for a user
# for clients that use it (RFC5397)
user_principal = /+%(user)s
+# base URL if / is not the CalDAV root
+base_prefix = /
[encoding]
# Encoding for responding requests