Add an option allowing requests without base_prefix
Related to #147, patch proposed by jheidemann
This commit is contained in:
parent
0822f99650
commit
9ad9c466e2
2
config
2
config
@ -34,6 +34,8 @@ ciphers =
|
|||||||
dns_lookup = True
|
dns_lookup = True
|
||||||
# Root URL of Radicale (starting and ending with a slash)
|
# Root URL of Radicale (starting and ending with a slash)
|
||||||
base_prefix = /
|
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
|
# Message displayed in the client when a password is needed
|
||||||
realm = Radicale - Password Required
|
realm = Radicale - Password Required
|
||||||
|
|
||||||
|
@ -252,6 +252,9 @@ class Application(object):
|
|||||||
environ["PATH_INFO"] = self.sanitize_uri(
|
environ["PATH_INFO"] = self.sanitize_uri(
|
||||||
"/%s" % environ["PATH_INFO"][len(base_prefix):])
|
"/%s" % environ["PATH_INFO"][len(base_prefix):])
|
||||||
log.LOGGER.debug("Sanitized path: %s", environ["PATH_INFO"])
|
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:
|
else:
|
||||||
# Request path not starting with base_prefix, not allowed
|
# Request path not starting with base_prefix, not allowed
|
||||||
log.LOGGER.debug(
|
log.LOGGER.debug(
|
||||||
|
@ -49,6 +49,7 @@ INITIAL_CONFIG = {
|
|||||||
"ciphers": "",
|
"ciphers": "",
|
||||||
"dns_lookup": "True",
|
"dns_lookup": "True",
|
||||||
"base_prefix": "/",
|
"base_prefix": "/",
|
||||||
|
"can_skip_base_prefix": "False",
|
||||||
"realm": "Radicale - Password Required"},
|
"realm": "Radicale - Password Required"},
|
||||||
"encoding": {
|
"encoding": {
|
||||||
"request": "utf-8",
|
"request": "utf-8",
|
||||||
|
Loading…
Reference in New Issue
Block a user