Skip to content

fix: route the proxy check through the proxy for both URL schemes - #62

Merged
jundymek merged 3 commits into
masterfrom
fix/proxy-scheme-mismatch
Aug 24, 2026
Merged

fix: route the proxy check through the proxy for both URL schemes#62
jundymek merged 3 commits into
masterfrom
fix/proxy-scheme-mismatch

Conversation

@jundymek

Copy link
Copy Markdown
Owner

Fixes #61

Problem

With default settings get() always failed with FreeProxyException: There are no working proxies at this time. after scanning the full list (~2 minutes), no matter how many proxies were actually working. Broken since 1.2.1.

requests selects the proxy from the proxies mapping by the scheme of the requested URL. The check built the mapping keyed only by the configured schema, so with the default http schema and the default https://www.google.com test URL no proxy was selected at all — the check ran over a direct connection and the peername verification (correctly) rejected every candidate.

Fix

Build the proxies mapping for both http and https, so the test URL is always routed through the proxy regardless of its scheme.

Verification

  • New regression test asserting the mapping covers both schemes (fails on master)
  • Full suite: 25 tests green
  • Live check: default FreeProxy().get() returns a working proxy in ~4 s (previously ~115 s scan ending in an exception)
  • End-to-end: a request through the returned proxy shows the proxy's IP as origin on httpbin.org/ip

Also included

  • CI workflow running the test suite on Python 3.9–3.13 for every push/PR (tests hitting real proxy-list sites are skipped on CI). Cherry-picked here so this and future PRs get automated checks.
  • Version bump to 1.2.3, CHANGELOG and README updated.

requests selects the proxy from the proxies mapping by the URL scheme.
The mapping was keyed only by the configured schema, so with default
settings (http schema, https test URL) no proxy was selected at all:
the check ran over a direct connection, the peername verification
rejected every candidate and get() always failed. Broken since 1.2.1.

Build the mapping for both http and https so the test URL is always
routed through the proxy, whatever its scheme. Bump version to 1.2.3.

Fixes #61
Run unit tests on every push and pull request across supported Python
versions. Tests hitting real proxy-list sites are skipped on CI to keep
the workflow deterministic.
The CI workflow relies on network-dependent tests being skipped when
CI=true, but the skip markers were missing on this branch -- the list
filter tests still hit real proxy-list sites, making CI runs flaky.

Also add a success-path test: a proxy whose IP answers the check is
returned by get(), with the peer socket mocked.
@jundymek
jundymek merged commit 7279176 into master Aug 24, 2026
5 checks passed
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.

get() always fails with default settings — proxy check bypasses the proxy (1.2.1–1.2.2)

1 participant