psf / psf/requests

windows proxy settings taken only partly

Open
#5,095 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
54.3k
Forks
10.5k
Avg merge
16h 43m
Merged PRs (30d)
3

Description

do run python 2.7/3.7 on a windows 7 host.
This host is AD managed. As part of the group policy the internet settings are set to automatically proxy configuration with an wpad.dat file at the AD server.
The configuration works. cos IE and Chrome can reach external and internal hosts. Some of the internal are excluded from proxy via no proxy rules inside the dat file.

But on python with requests im not able to reach the internal addresses which are excluded via the proxy file rules. Python always tries to get the data from the proxy.

The only solution was an extra environmental variable NO_PROXY with the ips not to be reached via the proxy.

These excluded IPs are common IPs and not private ! (90.0.0.0/8) is part of the wpad.dat exclusion

Expected Result

either no proxy or all proxy settings should taken into account.

Actual Result

every requests traffic is placed on the proxy
urllib3 works as expected

Reproduction Steps

import requests
import urllib3
http1 = urllib3.PoolManager()
r1 = http.request('GET', 'http://90.0.11.253:43001/')
r1.status 

r2 = requests.get('http://90.0.11.253:43001/')
r2.status_code

r1==r2 must be true but isnt

System Information

$ python -m requests.help
C:\Users\iwetzel\AppData\Local\Programs\Python\Python37-32>python -m requests.help
{
  "chardet": {
    "version": "3.0.4"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "2.8"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.7.1"
  },
  "platform": {
    "release": "7",
    "system": "Windows"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.21.0"
  },
  "system_ssl": {
    "version": "1010009f"
  },
  "urllib3": {
    "version": "1.24.3"
  },
  "using_pyopenssl": false
}

This command is only available on Requests v2.16.4 and greater. Otherwise,
please provide some basic information about your system (Python version,
operating system, &c).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the Windows 7 reproduction and comparing the proxy behavior of requests with urllib3 for the listed 90.0.11.253 URL and WPAD exclusion. Trace how the requests call obtains proxy settings versus the explicit NO_PROXY workaround. Done means the documented WPAD no-proxy rule is honored, or the limitation and supported configuration are clearly established with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.