Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsing of proxy url broken with requests 2.27.0 #6030

Closed
anneFly opened this issue Jan 5, 2022 · 1 comment
Closed

parsing of proxy url broken with requests 2.27.0 #6030

anneFly opened this issue Jan 5, 2022 · 1 comment

Comments

@anneFly
Copy link

anneFly commented Jan 5, 2022

It seems like this change #5917 unfortunately broke production for us.

We are using a proxy url that follows this scheme: http://randomstring:randomstring@eu-west-static-04.example.com:9293 (from a service that provides static IPs)

Expected Result

In 2.26.0 this still works:

>>> from requests.utils import prepend_scheme_if_needed
>>> prepend_scheme_if_needed('http://randomstring:randomstring@eu-west-static-04.example.com:9293', 'http')
'http://randomstring:randomstring@eu-west-static-04.example.com:9293'

Actual Result

In 2.27.0 it's broken:

>>> from requests.utils import prepend_scheme_if_needed
>>> prepend_scheme_if_needed('http://randomstring:randomstring@eu-west-static-04.example.com:9293', 'http')
'http://eu-west-static-04.example.com:9293'

This leads in the end to ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))) because the url was cut.

Reproduction Steps

>>> from requests.utils import prepend_scheme_if_needed
>>> prepend_scheme_if_needed('http://randomstring:randomstring@eu-west-static-04.example.com:9293', 'http')

System Information

{
  "chardet": {
    "version": null
  },
  "charset_normalizer": {
    "version": "2.0.9"
  },
  "cryptography": {
    "version": "36.0.1"
  },
  "idna": {
    "version": "3.3"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.9.9"
  },
  "platform": {
    "release": "5.14.21-2-MANJARO",
    "system": "Linux"
  },
  "pyOpenSSL": {
    "openssl_version": "101010df",
    "version": "21.0.0"
  },
  "requests": {
    "version": "2.27.0"
  },
  "system_ssl": {
    "version": "101010df"
  },
  "urllib3": {
    "version": "1.26.7"
  },
  "using_charset_normalizer": true,
  "using_pyopenssl": true
}
@nateprewitt
Copy link
Member

Hi, @anneFly. Thanks for the report! This is actually a duplicate of #6027 which has been patched in #6028 and will be released sometime today. You can track status in #6029.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants