Aggiunto un log migliore

This commit is contained in:
2026-07-01 15:40:27 +02:00
parent dde33c434d
commit b4d9907d53
2 changed files with 56 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ import socket
import threading
import time
from typing import Any, Dict, Iterable, Optional
from urllib.parse import urlsplit
import docker
@@ -274,7 +275,14 @@ def extract_user_from_http_request(data: bytes, known_users: Dict[str, Dict[str,
if candidate in known_users and candidate not in {"localhost", "127", "0"}:
return known_users[candidate], data, None
path, separator, query = target.partition("?")
parsed_target = urlsplit(target)
if parsed_target.scheme and parsed_target.netloc:
path = parsed_target.path or "/"
query = parsed_target.query
separator = "?" if query else ""
else:
path, separator, query = target.partition("?")
segments = [segment for segment in path.split("/") if segment]
if segments:
candidate = segments[0]
@@ -530,7 +538,7 @@ async def main():
log(
"Shared gateway ready: "
f"{format_access_url('localhost', GATEWAY_PORT)} "
"(host-based routing: http://<user>.localhost:{GATEWAY_PORT})"
f"(host-based routing: http://<user>.localhost:{GATEWAY_PORT})"
)
servers.append(gateway_server)