psf / requests

A simple, yet elegant, HTTP library.
https://requests.readthedocs.io/en/latest/
Apache License 2.0
51.78k stars 9.27k forks source link

Weird behaviour with https and proxy authentication #6578

Open pelfex opened 8 months ago

pelfex commented 8 months ago

requests.get is getting weird with some combinations of dictionary keys and proxy authentication.

Expected Result

print(requests.get('https://google.com', proxies={"https" : 'https://user:pass@ip:port'}))

Output: <Response [200]>

Actual Result

Doesn't run? (Maybe timeout) But it somehow fixes itself with these changes

print(requests.get('https://google.com', proxies={"http" : 'http://user:pass@ip:port'}))

Output: <Response [200]>

Reproduction Steps

import requests

print(requests.get('https://google.com', proxies={"https" : 'https://user:pass@ip:port'}))

print(requests.get('https://google.com', proxies={"http" : 'http://user:pass@ip:port'}))

System Information

$ python -m requests.help
{
  "chardet": {
    "version": null
  },
  "charset_normalizer": {
    "version": "2.0.12"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "3.4"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.10.11"
  },
  "platform": {
    "release": "10",
    "system": "Windows"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.27.1"
  },
  "system_ssl": {
    "version": "1010114f"
  },
  "urllib3": {
    "version": "1.26.9"
  },
  "using_charset_normalizer": true,
  "using_pyopenssl": false
}
$ python --version
Python 3.10.11
pelfex commented 8 months ago

proxies im using are https capable

pelfex commented 8 months ago

misclick

visions4k commented 7 months ago

its most likely that your proxies only support http protocol, it should work the way you have it, so its probably proxy issues.

pelfex commented 7 months ago

proxies im using are https capable

its most likely that your proxies only support http protocol, it should work the way you have it, so its probably proxy issues.