[fix][run_batch]: respect proxy env vars when downloading media URLs (#47697)
Signed-off-by: mauyuyuace <qiming1.zhang@intel.com>
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user