check content type
This commit is contained in:
parent
5d5a087c50
commit
459cfe231d
@ -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 = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user