Fix: x.com loading issues

Shorten X API URLs for relay error prevention.
This commit is contained in:
Pourya
2026-04-22 17:22:04 +03:30
committed by GitHub
parent 829de0bb2e
commit 2d959d4560
+5 -1
View File
@@ -951,7 +951,11 @@ class ProxyServer:
if b":" in raw_line:
k, v = raw_line.decode(errors="replace").split(":", 1)
headers[k.strip()] = v.strip()
# Shortening the length of X API URLs to prevent relay errors.
if host == "x.com" and re.match(r"/i/api/graphql/[^/]+/[^?]+\?variables=", path):
path = path.split("&")[0]
# MITM traffic arrives as origin-form paths; SOCKS/plain HTTP can
# also send absolute-form requests. Normalize both to full URLs.
if path.startswith("http://") or path.startswith("https://"):