From 72224d29d627c2cc5632bf74b43eb5edb9e3cdb7 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 31 Jan 2026 19:11:16 +0000 Subject: [PATCH] allow X-Forwarded-HTTP-Version; the request-header safeguard added in v1.20.5 was too strict --- copyparty/httpcli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index f9b5dc18..414e6297 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -172,6 +172,7 @@ RE_HSAFE = re.compile(r"[\x00-\x1f<>\"'&]") # search always much faster RE_HOST = re.compile(r"[^][0-9a-zA-Z.:_-]") # search faster <=17ch RE_MHOST = re.compile(r"^[][0-9a-zA-Z.:_-]+$") # match faster >=18ch RE_K = re.compile(r"[^0-9a-zA-Z_-]") # search faster <=17ch +RE_HTTP1 = re.compile(r"(GET|HEAD|POST|PUT) [^ ]+ HTTP/1.1$") RE_HR = re.compile(r"[<>\"'&]") RE_MDV = re.compile(r"(.*)\.([0-9]+\.[0-9]{3})(\.[Mm][Dd])$") RE_RSS_KW = re.compile(r"(\{[^} ]+\})") @@ -350,7 +351,7 @@ class HttpCli(object): for header_line in headerlines[1:]: k, zs = header_line.split(":", 1) self.headers[k.lower()] = zs.strip() - if zs.endswith(" HTTP/1.1"): + if zs.endswith(" HTTP/1.1") and RE_HTTP1.search(zs): raise Exception() except: headerlines = [repr(x) for x in headerlines]