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

HTTPS not working on Google App Engine #1905

Closed
cpavon opened this issue Feb 6, 2014 · 13 comments
Closed

HTTPS not working on Google App Engine #1905

cpavon opened this issue Feb 6, 2014 · 13 comments

Comments

@cpavon
Copy link

cpavon commented Feb 6, 2014

Take a look here: http://stackoverflow.com/questions/21605328/python-requests-on-google-app-engine-not-working-for-https

Thanks!

@Lukasa
Copy link
Member

Lukasa commented Feb 6, 2014

Unfortunately, Requests explicitly doesn't support GAE. It's just not Python. =)

@Lukasa Lukasa closed this as completed Feb 6, 2014
@piotr-dobrogost
Copy link

I guess directing OP to some details on why/how GAE is not Python would be appreciated :)

@Lukasa
Copy link
Member

Lukasa commented Feb 6, 2014

Heh, this is a fair point.

The short answer is that GAE doesn't use the same standard library as core Python does. This is particularly significant with the networking sections (e.g. socket, ssl, httplib) which are radically different from their standard library counterparts.

The number of differences is substantial, the differences themselves can often be subtle or only found after substantial use (e.g. rate limiting), and testing on GAE is relatively expensive for the core dev team to do.

For those reasons, it's easier for us simply to not support GAE. We're prepared to make small code changes if they fix an obvious problem for GAE, but we are disinclined to radically change the codebase for any non-standard Python version (see the recent pull request modifying the codebase for Jython, which was rejected).

If Requests doesn't work on GAE, GAE is bugged. We work fine on Python 3.3, Python 2.7, Python 2.6 and PyPy: GAE can sort itself out. =)

@rattrayalex
Copy link

Thanks for the explanation!

@rattrayalex
Copy link

I understand fixing AppEngine is not something you intend to pursue. In case it helps anyone else, though, I think I have found the cause: line 172 here. It's my impression that get_netrc_auth essentially fails on AppEngine, and without that, authentication will not survive redirects, resulting in infinite recursive redirects to any endpoint that requires Auth (not just POSTs).

I'm not sure, but the absence of the feature mentioned here: https://github.com/kennethreitz/requests/pull/1892#issuecomment-33730591 , which at the time seemed like a "nice-to-have", may be a factor.

@kennethreitz had seemed concerned that making this design decision for the developer might have adverse consequences... I wonder if there are others outside of the GAE ecosystem who would prefer Authentication tokens survive across redirects.

Perhaps an option to allow this would assuage the GAE community as well as those in similar situations?

@Lukasa
Copy link
Member

Lukasa commented Feb 7, 2014

There are absolutely people who would prefer that we keep the auth tokens on over redirects. However, both @sigmavirus24 and I very strongly believe that being insecure by default is dangerous. @kennethreitz has a more nuanced view than we do, and I acknowledge that. However, I think that #1892 is a good change.

However, this bug cannot be #1892 because we haven't released a version with #1892 in it yet. =)

@rattrayalex
Copy link

Well that's embarrassing =)
Thanks for your patience Lukasa.

(for the record, what I intended to suggest was opt-out for #1892, not opt-in).

@Lukasa
Copy link
Member

Lukasa commented Feb 7, 2014

There's no need to thank me, it's an easy mistake to make. I have the advantage of having written that particular fix, so I'm keeping track of it. ;)

The fix currently is opt-out: if you pass the argument allow_redirects=False, you can handle the redirect logic yourself and deal with authentication however you like.

@jacobg
Copy link

jacobg commented Nov 24, 2015

Hi @rattrayalex Your patch does not seem to work anymore, in particular to connect to Google IP addresses, as such IP's are blocked in GAE's new sockets API: https://cloud.google.com/appengine/docs/python/sockets/

@webmaven
Copy link
Contributor

/CC @jonparrott

@theacodes
Copy link

urllib3 now has contrib support for GAE. I haven't personally tested this out, but if you configure requests to use AppEngineManager instead of the normal PoolManager it should (in theory) work. I'll be happy to try to take on any issues with getting that to work.

@sigmavirus24
Copy link
Contributor

@Lukasa think that should go into the toolbelt?

@Lukasa
Copy link
Member

Lukasa commented Nov 24, 2015

Seems reasonable to me.

sigmavirus24 referenced this issue in requests/toolbelt Nov 24, 2015
At the moment this will not work because the AppEngineManager does not
have the same signature as urllib3's PoolManager.

Related to:
https://github.com/kennethreitz/requests/issues/1905#issuecomment-159380704
sigmavirus24 referenced this issue in requests/toolbelt Jan 23, 2016
At the moment this will not work because the AppEngineManager does not
have the same signature as urllib3's PoolManager.

Related to:
https://github.com/kennethreitz/requests/issues/1905#issuecomment-159380704
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants