Skip to content

Fix proxy URLs that start with "http" but carry no scheme - #1201

Open
Shriraj1901 wants to merge 1 commit into
ClickHouse:mainfrom
Shriraj1901:fix-proxy-url-scheme-detection
Open

Shriraj1901 wants to merge 1 commit into
ClickHouse:mainfrom
Shriraj1901:fix-proxy-url-scheme-detection

Conversation

@Shriraj1901

@Shriraj1901 Shriraj1901 commented Nov 17, 2026 •

Copy link
Copy Markdown

get_pool_manager() decided whether http_proxy or https_proxy already had a scheme by checking startswith("http"). A bare proxy host such as "httpproxy.corp:3128" or "http-proxy.corp:3128" matched, was handed to urllib3 as is, and the client failed with ProxySchemeUnknown. The same check did not recognize an upper case "HTTP://" prefix, so that value became "http://HTTP://proxy..." and urllib3 read the host as "http".

A scheme is now recognized only when the value contains "://". Values with an explicit scheme, and bare hosts that really have none, behave as before.

Summary

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

Note

Low Risk
Localized change to HTTP proxy URL normalization in httputil.get_pool_manager with new unit tests; no auth or data-path impact.

Overview
HTTP/HTTPS proxy URLs are normalized using a stricter scheme rule in get_pool_manager().

Previously, bare proxy hosts whose names started with http (for example httpproxy.corp:3128) were treated as already having a scheme and passed through to urllib3, which raised ProxySchemeUnknown. Uppercase values like HTTP://proxy.corp:3128 could also be double-prefixed and parsed with the wrong host.

The driver now adds a default scheme only when the value lacks ://, via _with_proxy_scheme. Explicit schemes are left unchanged; bare host:port values get http:// or https:// as appropriate. HTTP_PROXY / HTTPS_PROXY follow the same path when they are passed into pool creation. Parametrized unit tests assert the parsed proxy scheme, host, and port.

Reviewed by Cursor Bugbot for commit 276a157. Bugbot is set up for automated code reviews on this repo. Configure here.

get_pool_manager() decided whether http_proxy or https_proxy already had a
scheme by checking startswith("http"). A bare proxy host such as
"httpproxy.corp:3128" or "http-proxy.corp:3128" matched, was handed to
urllib3 as is, and the client failed with ProxySchemeUnknown. The same check
did not recognize an upper case "HTTP://" prefix, so that value became
"http://HTTP://proxy..." and urllib3 read the host as "http".

A scheme is now recognized only when the value contains "://". Values with an
explicit scheme, and bare hosts that really have none, behave as before.
@Shriraj1901
Shriraj1901 requested a review from a team as a code owner November 17, 2026 09:37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant