check content type

This commit is contained in:
Roy Olav Purser 2021-05-12 00:22:55 +02:00
parent 5d5a087c50
commit 459cfe231d
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -91,7 +91,6 @@ def upstream_type(current, proxy):
return resp.headers.get("Content-Type", "binary/octet-stream") return resp.headers.get("Content-Type", "binary/octet-stream")
def rewrite(current, provider, proxy, ctype): def rewrite(current, provider, proxy, ctype):
resp = requests.get(current, proxies=proxy.req) resp = requests.get(current, proxies=proxy.req)
ndata = None ndata = None
if resp.text is not None: if resp.text is not None:
@ -203,7 +202,7 @@ class MainHandler(tornado.web.RequestHandler):
else: else:
ctype = upstream_type(upstream, proxy) ctype = upstream_type(upstream, proxy)
data = None data = None
if "mpgurl" in ctype: if "mpegurl" in ctype.lower():
data = rewrite(upstream, provider, proxy) data = rewrite(upstream, provider, proxy)
else: else:
ldata = {} ldata = {}