print upstream proxy

This commit is contained in:
Roy Olav Purser 2021-05-30 14:04:29 +02:00
parent 34734bb7e4
commit 69e9a75d15
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -267,15 +267,17 @@ class MainHandler(tornado.web.RequestHandler):
self.write("Stream not found. (invalid upstream)")
else:
upstream_proxy = await handler.proxy.proxy_url(upstream, None)
logger.info(upstream_proxy)
ctype = await handler.proxy.content_type(upstream_proxy)
self.set_header("Content-Type", ctype)
if ctype == "application/vnd.apple.mpegurl":
async with handler.proxy.local() as session:
resp = await session.get(upstream_proxy)
data = await resp.read()
self.write(data)
elif redir:
self.redirect(upstream_proxy, status=303)
if redir:
if ctype == "application/vnd.apple.mpegurl":
async with handler.proxy.local() as session:
resp = await session.get(upstream_proxy)
data = await resp.read()
self.write(data)
else:
self.redirect(upstream_proxy, status=303)
async def get(self):
await self.handle_any(True)