Merge *base_prefix config keys into base_prefix (fixes #996)
This commit is contained in:
@@ -246,9 +246,17 @@ class Application(object):
|
||||
headers = pprint.pformat(self.headers_log(environ))
|
||||
log.LOGGER.debug("Request headers:\n%s" % headers)
|
||||
|
||||
# Sanitize request URI
|
||||
environ["PATH_INFO"] = self.sanitize_uri(environ["PATH_INFO"])
|
||||
log.LOGGER.debug("Sanitized path: %s", environ["PATH_INFO"])
|
||||
base_prefix = config.get("server", "base_prefix")
|
||||
if environ["PATH_INFO"].startswith(base_prefix):
|
||||
# Sanitize request URI
|
||||
environ["PATH_INFO"] = self.sanitize_uri(
|
||||
"/%s" % environ["PATH_INFO"][len(base_prefix):])
|
||||
log.LOGGER.debug("Sanitized path: %s", environ["PATH_INFO"])
|
||||
else:
|
||||
# Request path not starting with base_prefix, not allowed
|
||||
log.LOGGER.debug(
|
||||
"Path not starting with prefix: %s", environ["PATH_INFO"])
|
||||
environ["PATH_INFO"] = None
|
||||
|
||||
# Get content
|
||||
content_length = int(environ.get("CONTENT_LENGTH") or 0)
|
||||
|
Reference in New Issue
Block a user