PATH_INFO might not exist if it's empty
This commit is contained in:
parent
f12dd31b4b
commit
5704b5021b
@ -334,8 +334,8 @@ class Application:
|
||||
status, client.responses.get(status, "Unknown"))
|
||||
self.logger.info(
|
||||
"%s answer status for %r%s in %.3f seconds: %s",
|
||||
environ["REQUEST_METHOD"], environ["PATH_INFO"], depthinfo,
|
||||
(time_end - time_begin).total_seconds(), status)
|
||||
environ["REQUEST_METHOD"], environ.get("PATH_INFO", ""),
|
||||
depthinfo, (time_end - time_begin).total_seconds(), status)
|
||||
# Return response content
|
||||
return status, list(headers.items()), [answer] if answer else []
|
||||
|
||||
@ -372,6 +372,7 @@ class Application:
|
||||
environ.get("SCRIPT_NAME", "")).rstrip("/")
|
||||
self.logger.debug("Sanitized script name: %r", environ["SCRIPT_NAME"])
|
||||
base_prefix = environ["SCRIPT_NAME"]
|
||||
environ["PATH_INFO"] = environ.get("PATH_INFO", "")
|
||||
# Sanitize request URI (a WSGI server indicates with an empty path,
|
||||
# that the URL targets the application root without a trailing slash)
|
||||
if environ["PATH_INFO"]:
|
||||
|
Loading…
Reference in New Issue
Block a user