From 6091bd46a3fb405eb36a3cc947d5ea3ed93fc347 Mon Sep 17 00:00:00 2001 From: Unrud Date: Sat, 12 Sep 2020 20:23:45 +0200 Subject: [PATCH] Respond 405 for unsupported methods instead of server error --- radicale/app/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/radicale/app/__init__.py b/radicale/app/__init__.py index 85cbcc2..e138362 100644 --- a/radicale/app/__init__.py +++ b/radicale/app/__init__.py @@ -224,7 +224,10 @@ class Application( logger.debug("Sanitized path: %r", path) # Get function corresponding to method - function = getattr(self, "do_%s" % environ["REQUEST_METHOD"].upper()) + function = getattr( + self, "do_%s" % environ["REQUEST_METHOD"].upper(), None) + if not function: + return response(*httputils.METHOD_NOT_ALLOWED) # If "/.well-known" is not available, clients query "/" if path == "/.well-known" or path.startswith("/.well-known/"):