From 3a30cf29c13da523450c0b4144266225fe65182e Mon Sep 17 00:00:00 2001 From: blank X Date: Sun, 6 Jun 2021 22:03:47 +0700 Subject: [PATCH] Return 416 if Range doesn't start with bytes= --- streamtg.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/streamtg.py b/streamtg.py index 660da4e..af37c62 100644 --- a/streamtg.py +++ b/streamtg.py @@ -110,6 +110,14 @@ async def handler(request): } ) status = 206 + else: + return web.Response(status=416, + text='Unknown range type', + headers={ + 'Content-Range': f'bytes */{max_size}', + 'Accept-Ranges': 'bytes' + } + ) length = end - offset + 1 headers = { 'Content-Range': f'bytes {offset}-{end}/{max_size}',