Don't hardcode files
This commit is contained in:
parent
a3cb6064c3
commit
d5ed33982c
5
neomi.py
5
neomi.py
|
@ -24,6 +24,7 @@ default_config.port = 7070
|
||||||
default_config.recognised_selectors = ['0', '1', '5', '9', 'g', 'h', 'I', 's']
|
default_config.recognised_selectors = ['0', '1', '5', '9', 'g', 'h', 'I', 's']
|
||||||
default_config.request_max_size = 8192
|
default_config.request_max_size = 8192
|
||||||
default_config.socket_timeout = 1
|
default_config.socket_timeout = 1
|
||||||
|
default_config.no_selector_whitelist = {'robots.txt', 'favicon.ico'}
|
||||||
default_config.hurl_redirect_page = """<!DOCTYPE html>
|
default_config.hurl_redirect_page = """<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -199,8 +200,8 @@ def extract_selector_path(selector_path, *, config):
|
||||||
if len(selector_path) == 0: # / is by default of type 1
|
if len(selector_path) == 0: # / is by default of type 1
|
||||||
selector = '1'
|
selector = '1'
|
||||||
path = selector_path
|
path = selector_path
|
||||||
elif selector_path == 'robots.txt': # Special case robots.txt
|
elif selector_path in config.no_selector_whitelist: # Have a whitelist for selectorless files
|
||||||
selector = '0'
|
selector = None
|
||||||
path = selector_path
|
path = selector_path
|
||||||
else: # Extract the selector
|
else: # Extract the selector
|
||||||
selector = selector_path[0]
|
selector = selector_path[0]
|
||||||
|
|
Loading…
Reference in New Issue