diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-02-02 18:34:39 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-02-02 18:34:39 -0800 |
commit | b669050bed540c106a04ef30d1296ff385ebb6ba (patch) | |
tree | 8287d0aed2d90a847a1d5212a89817e68ba635ff | |
parent | fbcacc2c1a755c62e0fb7bb9bca75d23178f6645 (diff) | |
download | yt-local-b669050bed540c106a04ef30d1296ff385ebb6ba.tar.lz yt-local-b669050bed540c106a04ef30d1296ff385ebb6ba.tar.xz yt-local-b669050bed540c106a04ef30d1296ff385ebb6ba.zip |
server.py: remove obsolete code
-rw-r--r-- | server.py | 24 |
1 files changed, 1 insertions, 23 deletions
@@ -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: |