fix ipv4 location header on dualstack

This commit is contained in:
ed 2023-04-14 14:06:44 +02:00
parent 1550350e05
commit c8938fc033

View file

@ -264,9 +264,10 @@ class HttpCli(object):
self.is_https = (
self.headers.get("x-forwarded-proto", "").lower() == "https" or self.tls
)
self.host = self.headers.get("host") or "{}:{}".format(
*list(self.s.getsockname()[:2])
)
self.host = self.headers.get("host")
if not self.host:
zs = "{}:{}".format(*list(self.s.getsockname()[:2]))
self.host = zs[7:] if zs.startswith("::ffff:") else zs
n = self.args.rproxy
if n: