GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Standardize Windows proxy bypass (ProxyOverride) parsing to support wildcards and CIDR · Issue #149136 · python/cpython

Standardize Windows proxy bypass (ProxyOverride) parsing to support wildcards and CIDR #149136

New issue
Copy link
New issue
Copy link
Closed as duplicate
Closed as duplicate
Standardize Windows proxy bypass (ProxyOverride) parsing to support wildcards and CIDR#149136
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

Description

@Bais-Huang
Bais-Huang
opened on Apr 29, 2026
Issue body actions

Bug report

Bug description:

Summary:

Currently, urllib.request.getproxies_registry on Windows does not fully support the patterns defined in the Windows Registry key ProxyOverride. While modern browsers (Chrome/Edge) and Windows system components interpret wildcard patterns (e.g., 10.0.*) and CIDR notations, Python's urllib fails to match these when they are imported into the no_proxy list. This leads to inconsistent behavior where a script goes through a proxy even if the system settings explicitly dictate a bypass for that network.

The Problem:

  1. Wildcard IPs: Windows users often use 10.0.0.* to bypass a subnet. Python currently imports this string as-is, but the internal proxy_bypass logic treats it as a literal string or a domain suffix, failing to match an IP like 10.0.0.1.

  2. Missing support: The token in the registry (intended to bypass all local/intranet addresses) is often ignored or incorrectly handled when converted to the Python proxies dictionary.

Minimal Reproducible Example:

  1. Set Windows Proxy "Exceptions" to include 10.0.0.*.

  2. Run the following code:

import urllib.request

# Simulate registry lookup (current behavior)
# In reality, this is called internally by urllib.request.getproxies()
proxies = urllib.request.getproxies()
print(f"Detected NO_PROXY: {proxies.get('no')}")

# Attempt to bypass 10.0.0.1
url = "http://10.0.0.1"
should_bypass = urllib.request.proxy_bypass("10.0.0.1")
print(f"Should bypass {url}? {should_bypass}")

Expected: True (to match browser behavior)
Actual: False

Proposed Solution:

Enhance getproxies_registry in Lib/urllib/request.py to pre-process ProxyOverride items:

  • Convert * wildcard IP patterns (e.g., 10.*) into CIDR or standardized prefix strings.

  • Expand into localhost, 127.0.0.1, [::1].

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Activity

  1. Bais-Huang
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Apr 29, 2026
  2. picnixz
    added
    OS-windows
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    type-featureA feature request or enhancementA feature request or enhancement
    and removed
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Apr 29, 2026
  3. picnixz commented on Apr 29, 2026

    @picnixz
    picnixz
    on Apr 29, 2026
    Member
    More actions

    AFAIK there is no RFC about what NO_PROXY should really look like. IIRC, we only support literal matching and not patterns. As such, I would consider it a feature. If however a pattern is accepted when directly setting the NO_PROXY env (apart from the general wildcars '*'), I would be willing to consider it a bug.

  4. picnixz
    removed
    OS-windows
    on Apr 29, 2026
  5. Bais-Huang commented on Apr 29, 2026

    @Bais-Huang
    Bais-Huang
    on Apr 29, 2026
    Author
    More actions

    AFAIK there is no RFC about what NO_PROXY should really look like. IIRC, we only support literal matching and not patterns. As such, I would consider it a feature. If however a pattern is accepted when directly setting the NO_PROXY env (apart from the general wildcars '*'), I would be willing to consider it a bug.

    Thank you very much for your response, and I apologize for not describing the issue clearly.

    On Windows, when using getproxies, the implementation reads the ProxyServer entry from the registry, but does not properly incorporate the ProxyOverride entry. As a result, the returned proxies dictionary may miss the no (no_proxy) configuration.

    Additionally, when proxy_bypass is used, entries from ProxyOverride are typically defined using pattern-based rules. However, the current implementation in proxy_bypass_registry performs literal matching only, which can cause requests that are expected to bypass the proxy to incorrectly go through it.

    This is the issue I was trying to describe.

  6. picnixz commented on May 12, 2026

    @picnixz
    picnixz
    on May 12, 2026
    Member
    More actions

    I'm going to close this one in favor of #149746 since the other has a bit more context with the additional DPO thread I totally forgot about. But thanks for reviving this feature request.

  7. picnixz
    closed this as a duplicateof CIDR support for proxy bypass list #149746 on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.