proxy logic

This commit is contained in:
Roy Olav Purser 2021-05-09 21:12:14 +02:00
parent b2550a8c1c
commit b77e0a11cc
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -59,9 +59,13 @@ except Exception as e:
def get_proxy_url(proxy, current, path): def get_proxy_url(proxy, current, path):
data = {} data = {}
data["upstream"] = urllib.parse.urljoin(current, path) data["upstream"] = urllib.parse.urljoin(current, path)
data["proxy"] = proxy data["proxied"] = True
ret = None ret = None
if proxy is None or proxy_server is None: if proxy is None:
data["proxied"] = False
else:
data["proxy"] = proxy
if proxy_server is None:
return data["upstream"] return data["upstream"]
presp = requests.post(proxy_server, json=data) presp = requests.post(proxy_server, json=data)
return presp.text return presp.text