From d5ed33982c96183beb6ed62587b12a411fadd466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 17 Jun 2018 22:18:28 +0300 Subject: [PATCH] Don't hardcode files --- neomi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neomi.py b/neomi.py index 6e0d7d2..834419e 100644 --- a/neomi.py +++ b/neomi.py @@ -24,6 +24,7 @@ default_config.port = 7070 default_config.recognised_selectors = ['0', '1', '5', '9', 'g', 'h', 'I', 's'] default_config.request_max_size = 8192 default_config.socket_timeout = 1 +default_config.no_selector_whitelist = {'robots.txt', 'favicon.ico'} default_config.hurl_redirect_page = """ @@ -199,8 +200,8 @@ def extract_selector_path(selector_path, *, config): if len(selector_path) == 0: # / is by default of type 1 selector = '1' path = selector_path - elif selector_path == 'robots.txt': # Special case robots.txt - selector = '0' + elif selector_path in config.no_selector_whitelist: # Have a whitelist for selectorless files + selector = None path = selector_path else: # Extract the selector selector = selector_path[0]