From 98e4726a147f37666e1e9adc468e673b32373e21 Mon Sep 17 00:00:00 2001 From: Qiming Zhang Date: Mon, 6 Jul 2026 05:45:48 -0700 Subject: [PATCH] [fix][run_batch]: respect proxy env vars when downloading media URLs (#47697) Signed-off-by: mauyuyuace --- vllm/entrypoints/openai/run_batch.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/vllm/entrypoints/openai/run_batch.py b/vllm/entrypoints/openai/run_batch.py index 58975b4f86..6ae608da0a 100644 --- a/vllm/entrypoints/openai/run_batch.py +++ b/vllm/entrypoints/openai/run_batch.py @@ -28,6 +28,7 @@ from urllib3.util import parse_url import vllm.envs as envs from vllm.config import config +from vllm.connections import global_http_connection from vllm.engine.arg_utils import AsyncEngineArgs from vllm.engine.protocol import EngineClient from vllm.entrypoints.openai.api_server import init_app_state @@ -493,18 +494,9 @@ async def download_bytes_from_url( # between urllib3 and aiohttp (e.g. backslash-@ attacks). url = url_spec.url - async with ( - aiohttp.ClientSession() as session, - session.get( - url, - allow_redirects=envs.VLLM_MEDIA_URL_ALLOW_REDIRECTS, - ) as resp, - ): - if resp.status != 200: - raise Exception( - f"Failed to download data from URL: {url}. Status: {resp.status}" - ) - return await resp.read() + return await global_http_connection.async_get_bytes( + url, allow_redirects=envs.VLLM_MEDIA_URL_ALLOW_REDIRECTS + ) else: raise ValueError(