This commit is contained in:
ed 2023-04-20 21:41:47 +00:00
parent 2459965ca8
commit 42099baeff
8 changed files with 49 additions and 14 deletions

View file

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