mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-31 19:50:55 +00:00
Warning instead of error when base prefix ends with '/'
Workaround for #1210
This commit is contained in:
parent
e4cc73098a
commit
2cbbd4dc9c
2 changed files with 23 additions and 8 deletions
|
@ -67,8 +67,14 @@ permissions: RrWw""")
|
|||
|
||||
def test_root_broken_script_name(self) -> None:
|
||||
"""GET request at "/" with SCRIPT_NAME ending with "/"."""
|
||||
for script_name in ["/", "/radicale/", "radicale"]:
|
||||
self.get("/", check=500, SCRIPT_NAME=script_name)
|
||||
for script_name, prefix in [
|
||||
("/", ""), ("//", ""), ("/radicale/", "/radicale"),
|
||||
("radicale", None), ("radicale//", None)]:
|
||||
_, headers, _ = self.request(
|
||||
"GET", "/", check=500 if prefix is None else 302,
|
||||
SCRIPT_NAME=script_name)
|
||||
assert (prefix is None or
|
||||
headers.get("Location") == prefix + "/.web")
|
||||
|
||||
def test_root_http_x_script_name(self) -> None:
|
||||
"""GET request at "/" with HTTP_X_SCRIPT_NAME."""
|
||||
|
@ -79,8 +85,14 @@ permissions: RrWw""")
|
|||
|
||||
def test_root_broken_http_x_script_name(self) -> None:
|
||||
"""GET request at "/" with HTTP_X_SCRIPT_NAME ending with "/"."""
|
||||
for script_name in ["/", "/radicale/", "radicale"]:
|
||||
self.get("/", check=400, HTTP_X_SCRIPT_NAME=script_name)
|
||||
for script_name, prefix in [
|
||||
("/", ""), ("//", ""), ("/radicale/", "/radicale"),
|
||||
("radicale", None), ("radicale//", None)]:
|
||||
_, headers, _ = self.request(
|
||||
"GET", "/", check=400 if prefix is None else 302,
|
||||
HTTP_X_SCRIPT_NAME=script_name)
|
||||
assert (prefix is None or
|
||||
headers.get("Location") == prefix + "/.web")
|
||||
|
||||
def test_sanitized_path(self) -> None:
|
||||
"""GET request with unsanitized paths."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue