mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
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)
This commit is contained in:
parent
19189afb34
commit
84f5f41747
|
@ -189,11 +189,11 @@ class HttpCli(object):
|
||||||
self.log_src = conn.log_src # mypy404
|
self.log_src = conn.log_src # mypy404
|
||||||
self.gen_fk = self._gen_fk if self.args.log_fk else gen_filekey
|
self.gen_fk = self._gen_fk if self.args.log_fk else gen_filekey
|
||||||
self.tls: bool = hasattr(self.s, "cipher")
|
self.tls: bool = hasattr(self.s, "cipher")
|
||||||
|
self.is_vproxied = bool(self.args.R)
|
||||||
|
|
||||||
# placeholders; assigned by run()
|
# placeholders; assigned by run()
|
||||||
self.keepalive = False
|
self.keepalive = False
|
||||||
self.is_https = False
|
self.is_https = False
|
||||||
self.is_vproxied = False
|
|
||||||
self.in_hdr_recv = True
|
self.in_hdr_recv = True
|
||||||
self.headers: dict[str, str] = {}
|
self.headers: dict[str, str] = {}
|
||||||
self.mode = " " # http verb
|
self.mode = " " # http verb
|
||||||
|
@ -401,7 +401,6 @@ class HttpCli(object):
|
||||||
self.bad_xff = True
|
self.bad_xff = True
|
||||||
else:
|
else:
|
||||||
self.ip = cli_ip
|
self.ip = cli_ip
|
||||||
self.is_vproxied = bool(self.args.R)
|
|
||||||
self.log_src = self.conn.set_rproxy(self.ip)
|
self.log_src = self.conn.set_rproxy(self.ip)
|
||||||
self.host = self.headers.get("x-forwarded-host") or self.host
|
self.host = self.headers.get("x-forwarded-host") or self.host
|
||||||
trusted_xff = True
|
trusted_xff = True
|
||||||
|
@ -534,6 +533,7 @@ class HttpCli(object):
|
||||||
else:
|
else:
|
||||||
t = "incorrect --rp-loc or webserver config; expected vpath starting with %r but got %r"
|
t = "incorrect --rp-loc or webserver config; expected vpath starting with %r but got %r"
|
||||||
self.log(t % (self.args.R, vpath), 1)
|
self.log(t % (self.args.R, vpath), 1)
|
||||||
|
self.is_vproxied = False
|
||||||
|
|
||||||
self.ouparam = uparam.copy()
|
self.ouparam = uparam.copy()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue