resolved RESOLVED UNSUBMITTED PASS · None tool calls · 0 s · psf/requests
Trim excess leading path separators A URL with excess leading / (path-separator)s would cause urllib3 to attempt to reparse the request-uri as a full URI with a host and port. This bypasses that logic in ConnectionPool.urlopen by replacing these leading /s with just a single /. Closes #6643
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/src/requests/adapters.py
+++ b/src/requests/adapters.py
@@ -390,6 +390,9 @@ def request_url(self, request, proxies):
using_socks_proxy = proxy_scheme.startswith("socks")
url = request.path_url
+ if url.startswith("//"): # Don't confuse urllib3
+ url = f"/{url.lstrip('/')}"
+
if is_proxied_http_request and not using_socks_proxy:
url = urldefragauth(request.url)
. [100%]
=============================== warnings summary ===============================
../../../../../../../Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/requests/lib/python3.13/site-packages/_pytest/config/__init__.py:1464
/Users/jp/repos/kaggle-gemini-coding-agent-post-training/.envs/requests/lib/python3.13/site-packages/_pytest/config/__init__.py:1464: PytestConfigWarning: Unknown config option: timeout
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
1 passed, 1 warning in 0.01s
[2026-09-23 18:22:06,916] WARNING in core: flasgger is not installed; serving the static landing page at / and skipping the Swagger UI and /spec.json.