From 84f5f417475db225173ae63e4159a9eb6d9cb367 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 19 May 2025 22:01:29 +0000 Subject: [PATCH] unconditionally apply `--rp-loc` (#165) previously, `--rp-loc` only took effect for trusted reverse-proxies this was a source of confusion when setting up a config from scratch, since there is no obvious relation to `--xff-src` as this behavior was incidental, `--rp-loc` is now always applied, even if the proxy is untrusted (or not detected at all) --- copyparty/httpcli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index c33985a9..6f7f3297 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -189,11 +189,11 @@ class HttpCli(object): self.log_src = conn.log_src # mypy404 self.gen_fk = self._gen_fk if self.args.log_fk else gen_filekey self.tls: bool = hasattr(self.s, "cipher") + self.is_vproxied = bool(self.args.R) # placeholders; assigned by run() self.keepalive = False self.is_https = False - self.is_vproxied = False self.in_hdr_recv = True self.headers: dict[str, str] = {} self.mode = " " # http verb @@ -401,7 +401,6 @@ class HttpCli(object): self.bad_xff = True else: self.ip = cli_ip - self.is_vproxied = bool(self.args.R) self.log_src = self.conn.set_rproxy(self.ip) self.host = self.headers.get("x-forwarded-host") or self.host trusted_xff = True @@ -534,6 +533,7 @@ class HttpCli(object): else: t = "incorrect --rp-loc or webserver config; expected vpath starting with %r but got %r" self.log(t % (self.args.R, vpath), 1) + self.is_vproxied = False self.ouparam = uparam.copy()