From 9179e5562a1db84bde9e927b40ada93adee99027 Mon Sep 17 00:00:00 2001 From: Fabien LOISON Date: Thu, 4 Aug 2011 18:13:52 +0200 Subject: [PATCH] Display an 'It Works' message when the root URL is requested with the GET method --- radicale/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/radicale/__init__.py b/radicale/__init__.py index 2dd1975..98d0cb9 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -161,6 +161,18 @@ class Application(object): environ["PATH_INFO"] = self.sanitize_uri(environ["PATH_INFO"]) log.LOGGER.debug("Sanitized path: %s", environ["PATH_INFO"]) + # Display an "It Works" message if the root URL is requested with + # the GET method + if environ["REQUEST_METHOD"].lower() == "get" \ + and environ["PATH_INFO"] == "/": + headers = {"Content-type": "text/html"} + start_response("200 OK", list(headers.items())) + return ["\n", + "Radicale Works!\n", + "

Radicale Works!

", + 'radicale.org', + "\n"] + # Get content content_length = int(environ.get("CONTENT_LENGTH") or 0) if content_length: