From aafa84bfa39c1d188800a64668428b00af522fc4 Mon Sep 17 00:00:00 2001 From: pablusha Date: Thu, 7 Aug 2025 18:04:36 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B5=D1=89=D0=B5=20=D0=B1=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D1=88=D0=B5=20=D0=B3=D0=BE=D0=B2=D0=BD=D0=BE=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- config.py | 1 + main.py | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 08d72d3..6e049ef 100644 --- a/README.md +++ b/README.md @@ -45,4 +45,4 @@ pip install aiofiles ### ошибки - `e404_file` - html файл, который будет отправлен при ошибке 404 -- `e404_msg` - лог при ошибке 404 (по умолчанию - ` err 404 `) \ No newline at end of file +- `e404_msg` - лог при ошибке 404 \ No newline at end of file diff --git a/config.py b/config.py index 10e8c6d..f19d8a4 100644 --- a/config.py +++ b/config.py @@ -1,4 +1,5 @@ name="debweb 1.1.0" +proxied=False addr="localhost" port=7856 diff --git a/main.py b/main.py index 208d389..e8e5612 100644 --- a/main.py +++ b/main.py @@ -10,6 +10,8 @@ import os class WebServer: def __init__(self): self.name = config.name + self.proxied = config.proxied + self._addr = config.addr self._port = config.port @@ -46,6 +48,9 @@ class WebServer: data = unquote(data.decode()) if not data: return + real_addr = "".join([l.replace("X-Real-IP: ", "") for l in data.split("\n") if l.startswith("X-Real-IP: ")][0]).strip() # ТАКОЙ ГАВНАКОД XD + if real_addr and self.proxied: + addr = (real_addr, addr[1]) request = data.split("\n")[0] file_name = request.split()[1][1:] file_path = self.directory + file_name