From b669050bed540c106a04ef30d1296ff385ebb6ba Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 2 Feb 2019 18:34:39 -0800 Subject: server.py: remove obsolete code --- server.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/server.py b/server.py index 90a318e..17da4cc 100644 --- a/server.py +++ b/server.py @@ -14,18 +14,6 @@ import re import settings -BAN_FILE = "banned_addresses.txt" -try: - with open(BAN_FILE, 'r') as f: - banned_addresses = f.read().splitlines() -except FileNotFoundError: - banned_addresses = () - -def ban_address(address): - banned_addresses.append(address) - with open(BAN_FILE, 'a') as f: - f.write(address + "\n") - def youtu_be(env, start_response): id = env['PATH_INFO'][1:] @@ -83,21 +71,11 @@ def site_dispatch(env, start_response): try: method = env['REQUEST_METHOD'] path = env['PATH_INFO'] - if client_address in banned_addresses: - yield error_code('403 Fuck Off', start_response) - return + if method=="POST" and client_address not in ('127.0.0.1', '::1'): yield error_code('403 Forbidden', start_response) return - if "phpmyadmin" in path or (path == "/" and method == "HEAD"): - #ban_address(client_address) - start_response('403 Fuck Off', ()) - yield b'403 Fuck Off' - return - '''if env['QUERY_STRING']: - path += '?' + env['QUERY_STRING']''' - #path_parts = urllib.parse.urlparse(path) try: env['SERVER_NAME'], env['PATH_INFO'] = split_url(path[1:]) except ValueError: -- cgit v1.2.3