From 0045d446b8325bd851cc3b65ae6ca7ff901a06ec Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Mon, 6 Jan 2025 10:57:02 +0800 Subject: [PATCH 1/2] chore:status code(#779) --- utils/speed.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/speed.py b/utils/speed.py index 3c9c0958ee0..87095ac840d 100644 --- a/utils/speed.py +++ b/utils/speed.py @@ -30,8 +30,8 @@ async def get_speed_with_download(url: str, session: ClientSession = None, timeo created_session = False try: async with session.get(url, timeout=timeout) as response: - if response.status == 404: - raise Exception("404") + if response.status != 200: + raise Exception("Invalid response") info['delay'] = int(round((time() - start_time) * 1000)) async for chunk in response.content.iter_any(): if chunk: From f6f32af71fed567902a00194e89530dd27531452 Mon Sep 17 00:00:00 2001 From: "guorong.zheng" <360996299@qq.com> Date: Mon, 6 Jan 2025 11:15:21 +0800 Subject: [PATCH 2/2] fix:cookie illegal key(#728,#787) --- utils/speed.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/speed.py b/utils/speed.py index 87095ac840d..f0f6423ac2a 100644 --- a/utils/speed.py +++ b/utils/speed.py @@ -1,4 +1,5 @@ import asyncio +import http.cookies import json import re import subprocess @@ -13,6 +14,8 @@ from utils.config import config from utils.tools import is_ipv6, remove_cache_info, get_resolution_value +http.cookies._is_legal_key = lambda _: True + async def get_speed_with_download(url: str, session: ClientSession = None, timeout: int = config.sort_timeout) -> dict[ str, float | None]: