From 9ad9c466e21a7a83484d697de582f4ce1724a991 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Wed, 6 Aug 2014 11:51:11 +0200 Subject: [PATCH] Add an option allowing requests without base_prefix Related to #147, patch proposed by jheidemann --- config | 2 ++ radicale/__init__.py | 3 +++ radicale/config.py | 1 + 3 files changed, 6 insertions(+) diff --git a/config b/config index b9df3764..9c7b8a9a 100644 --- a/config +++ b/config @@ -34,6 +34,8 @@ ciphers = dns_lookup = True # Root URL of Radicale (starting and ending with a slash) base_prefix = / +# Possibility to allow URLs cleaned by a HTTP server, without the base_prefix +can_skip_base_prefix = False # Message displayed in the client when a password is needed realm = Radicale - Password Required diff --git a/radicale/__init__.py b/radicale/__init__.py index 8451e435..376973a7 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -252,6 +252,9 @@ class Application(object): environ["PATH_INFO"] = self.sanitize_uri( "/%s" % environ["PATH_INFO"][len(base_prefix):]) log.LOGGER.debug("Sanitized path: %s", environ["PATH_INFO"]) + elif config.get("server", "can_skip_base_prefix"): + log.LOGGER.debug( + "Skipped already sanitized path: %s", environ["PATH_INFO"]) else: # Request path not starting with base_prefix, not allowed log.LOGGER.debug( diff --git a/radicale/config.py b/radicale/config.py index f6ac6f02..3ba983eb 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -49,6 +49,7 @@ INITIAL_CONFIG = { "ciphers": "", "dns_lookup": "True", "base_prefix": "/", + "can_skip_base_prefix": "False", "realm": "Radicale - Password Required"}, "encoding": { "request": "utf-8",