mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
is_http now a class variable. Also checks lowercase value
This commit is contained in:
parent
5aff39d2b2
commit
fc7fe70f66
|
@ -94,6 +94,7 @@ class HttpCli(object):
|
||||||
def run(self):
|
def run(self):
|
||||||
"""returns true if connection can be reused"""
|
"""returns true if connection can be reused"""
|
||||||
self.keepalive = False
|
self.keepalive = False
|
||||||
|
self.is_https = False
|
||||||
self.headers = {}
|
self.headers = {}
|
||||||
self.hint = None
|
self.hint = None
|
||||||
try:
|
try:
|
||||||
|
@ -131,6 +132,7 @@ class HttpCli(object):
|
||||||
|
|
||||||
v = self.headers.get("connection", "").lower()
|
v = self.headers.get("connection", "").lower()
|
||||||
self.keepalive = not v.startswith("close") and self.http_ver != "HTTP/1.0"
|
self.keepalive = not v.startswith("close") and self.http_ver != "HTTP/1.0"
|
||||||
|
self.is_https = (self.headers.get("x-forwarded-proto", "").lower() == "https" or self.tls)
|
||||||
|
|
||||||
n = self.args.rproxy
|
n = self.args.rproxy
|
||||||
if n:
|
if n:
|
||||||
|
@ -1127,10 +1129,9 @@ class HttpCli(object):
|
||||||
)
|
)
|
||||||
# truncated SHA-512 prevents length extension attacks;
|
# truncated SHA-512 prevents length extension attacks;
|
||||||
# using SHA-512/224, optionally SHA-512/256 = :64
|
# using SHA-512/224, optionally SHA-512/256 = :64
|
||||||
is_https = (self.headers.get("x-forwarded-proto") == "https" or self.tls)
|
|
||||||
jpart = {
|
jpart = {
|
||||||
"url": "{}://{}/{}".format(
|
"url": "{}://{}/{}".format(
|
||||||
"https" if is_https else "http",
|
"https" if self.is_https else "http",
|
||||||
self.headers.get("host", "copyparty"),
|
self.headers.get("host", "copyparty"),
|
||||||
vpath + vsuf,
|
vpath + vsuf,
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue