Skip to content

[Misc] Replace urllib's urlparse with urllib3's parse_url#32746

Merged
DarkLight1337 merged 4 commits intovllm-project:mainfrom
Isotr0py:replace-urlparse
Jan 22, 2026
Merged

[Misc] Replace urllib's urlparse with urllib3's parse_url#32746
DarkLight1337 merged 4 commits intovllm-project:mainfrom
Isotr0py:replace-urlparse

Conversation

@Isotr0py
Copy link
Copy Markdown
Member

@Isotr0py Isotr0py commented Jan 21, 2026

Purpose

  • Replace urllib's urlparse with urllib3's parse_url for safer and more standard url parsing.

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@mergify mergify bot added the multi-modality Related to multi-modality (#4194) label Jan 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly replaces urllib.parse.urlparse with urllib3.util.parse_url across the codebase. The changes account for the differences in the return values, particularly how None is handled by urllib3. My review includes one suggestion to improve error handling for malformed data URLs to provide clearer error messages.

Comment on lines +111 to +112
url_spec_path = url_spec.path or ""
data_spec, data = url_spec_path.split(",", 1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While adding or "" correctly prevents an AttributeError when url_spec.path is None, it can lead to a generic and less informative ValueError if an invalid data URL is provided (e.g., one missing the data part after the comma). It would be more robust to explicitly check for a valid data URL path and raise an error with a more specific message, including the problematic URL.

Suggested change
url_spec_path = url_spec.path or ""
data_spec, data = url_spec_path.split(",", 1)
if not url_spec.path or "," not in url_spec.path:
raise ValueError(f"Invalid data URL, cannot find data part: {url_spec.unparse()}")
data_spec, data = url_spec.path.split(",", 1)

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR


if url_spec.scheme.startswith("http"):
if url_spec.scheme and url_spec.scheme.startswith("http"):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data URLs fail due to urllib3 parse_url scheme detection

High Severity

The switch from urllib.parse.urlparse to urllib3.util.parse_url breaks data URL handling. Data URLs use the data:content format without ://, but parse_url is designed for HTTP URLs and expects scheme://authority/path format. For a data URL like data:image/png;base64,abc, parse_url returns None for the scheme, causing the check if url_spec.scheme == "data" to fail. This results in valid data URLs being rejected with "The URL must be either a HTTP, data or file URL" error, breaking multimodal image/audio/video inputs that use base64 data URLs.

Additional Locations (1)

Fix in Cursor Fix in Web


parsed = urlparse(port)
parsed = parse_url(port)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing exception handling for LocationParseError in port validation

Medium Severity

The get_vllm_port function catches ValueError from int(port) and then calls parse_url(port) to detect URI-like values and provide helpful error messages. However, urllib3.util.parse_url can raise LocationParseError for certain malformed inputs (e.g., invalid IPv6 addresses, overly long labels), while the original urlparse never raised exceptions. This uncaught exception would bypass the helpful error messages and cause an unexpected crash during application startup when VLLM_PORT is misconfigured with certain malformed values.

Fix in Cursor Fix in Web

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) January 21, 2026 03:18
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 21, 2026
@DarkLight1337
Copy link
Copy Markdown
Member

I think the failing test is related

@Isotr0py Isotr0py disabled auto-merge January 21, 2026 17:01
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
@DarkLight1337 DarkLight1337 merged commit 8ebf271 into vllm-project:main Jan 22, 2026
49 checks passed
@Isotr0py Isotr0py deleted the replace-urlparse branch January 22, 2026 09:13
khluu pushed a commit that referenced this pull request Jan 23, 2026
Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
(cherry picked from commit 8ebf271)
monajafi-amd pushed a commit to monajafi-amd/vllm that referenced this pull request Jan 23, 2026
…roject#32746)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: mohammad najafi <mohammad.najafi@amd.com>
cwazai pushed a commit to cwazai/vllm that referenced this pull request Jan 25, 2026
…roject#32746)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: 陈建华 <1647430658@qq.com>
lapy pushed a commit to lapy/vllm that referenced this pull request Jan 27, 2026
…roject#32746)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
yma11 pushed a commit to yma11/vllm that referenced this pull request Feb 3, 2026
* Replace urllib's `urlparse` with urllib3's `parse_url` (vllm-project#32746)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
(cherry picked from commit 8ebf271)

* Bump opencv-python dependecy version to 4.13 (vllm-project#32668)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
(cherry picked from commit 444e2e7)

* Fix Whisper/encoder-decoder GPU memory leak (vllm-project#32789)

Signed-off-by: NickLucche <nlucches@redhat.com>
(cherry picked from commit ea6102b)

---------

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Signed-off-by: NickLucche <nlucches@redhat.com>
Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>
Co-authored-by: Nicolò Lucchesi <nlucches@redhat.com>
ItzDEXX pushed a commit to ItzDEXX/vllm that referenced this pull request Feb 19, 2026
…roject#32746)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
dtrifiro added a commit to dtrifiro/vllm that referenced this pull request Mar 9, 2026
- [build] fix cu130 related release pipeline steps and publish as
nightly image (vllm-project#32522)
- [Misc] Replace urllib's `urlparse` with urllib3's `parse_url`
(vllm-project#32746)
- [Misc] Bump opencv-python dependency version to 4.13
(vllm-project#32668)
- [Bugfix] Fix Whisper/encoder-decoder GPU memory leak
(vllm-project#32789)
- [CI] fix version comparsion and exclusion patterns in
upload-release-wheels.sh (vllm-project#32971)
- tokenizers: mistral: fix merge conflict
- `Dockerfile.tpu.ubi`: add `git` to allow `pip install git+https`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multi-modality Related to multi-modality (#4194) ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants