From 0b7e9d73c93cb64c843cad160951654bb13981ae Mon Sep 17 00:00:00 2001 From: Unrud Date: Fri, 21 Jan 2022 19:56:56 +0100 Subject: [PATCH] Improve log message --- radicale/app/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/radicale/app/__init__.py b/radicale/app/__init__.py index 8ffda13..fdf0d1f 100644 --- a/radicale/app/__init__.py +++ b/radicale/app/__init__.py @@ -188,9 +188,10 @@ class Application(ApplicationPartDelete, ApplicationPartHead, # SCRIPT_NAME is already removed from PATH_INFO, according to the # WSGI specification. # Reverse proxies can overwrite SCRIPT_NAME with X-SCRIPT-NAME header - base_prefix = environ.get("HTTP_X_SCRIPT_NAME", - environ.get("SCRIPT_NAME", "")) - logger.debug("Base prefix: %r", base_prefix) + base_prefix_src = ("HTTP_X_SCRIPT_NAME" if "HTTP_X_SCRIPT_NAME" in + environ else "SCRIPT_NAME") + base_prefix = environ.get(base_prefix_src, "") + logger.debug("Base prefix (from %s): %r", base_prefix_src, base_prefix) # Sanitize request URI (a WSGI server indicates with an empty path, # that the URL targets the application root without a trailing slash) path = pathutils.sanitize_path(unsafe_path)