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

Add Kerberos proxy authentication handling #149

Merged
merged 3 commits into from
Nov 29, 2021

Conversation

enzolis
Copy link
Contributor

@enzolis enzolis commented Apr 7, 2020

This is a PR based on the discussion here:
#148

Basically, it adds handling of status code 407 and the generation of an authentication header to communicate via an authenticating proxy (in my case a company proxy).

@enzolis enzolis mentioned this pull request Apr 7, 2020
@jborean93
Copy link
Contributor

The changes in #163 has resulted in some merge conflicts in the test file. If you are still interested in getting this in I can have a look at the changes once it has been fixed otherwise I'll close this PR.

@jborean93
Copy link
Contributor

jborean93 commented Nov 19, 2021

Thanks for rebasing the code. I've just had a play with the changes here and I was able to authenticate with a Kerberos backed proxy when connecting to a HTTP endpoint but it seems like this doesn't work for HTTPS endpoint (the final target is HTTPS not the proxy). Requests fails with

requests.exceptions.ProxyError: HTTPSConnectionPool(host='hostname', port=1234): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

It does seem like this might be a bug in requests/urllib3 where it is not calling the auth handler for failed CONNECT requests which is how proxies work when the final target is a HTTPS endpoint. Is this something you can replicate on your end, just trying to rule out whether this is just maybe an environment problem on my side or something that should be called out explicitly.

@enzolis
Copy link
Contributor Author

enzolis commented Nov 19, 2021

Hi Jordan,

this is unfortunately correct. I think these contain the relevant information:
psf/requests#1582
urllib3/urllib3#242

BR

@jborean93
Copy link
Contributor

Thanks for clarifying, I think for the initial work we can live with that support and add HTTPS support in the future if requests eventually fixes that problem.

@jborean93 jborean93 merged commit 9fb9414 into requests:master Nov 29, 2021
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.

2 participants