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
Fix App Engine Tunnel Host #1504
Conversation
…on. Make sure we check for that. urllib3#1503. Not this reverts part of the change in urllib3#1430.
Codecov Report
@@ Coverage Diff @@
## master #1504 +/- ##
==========================================
- Coverage 66.84% 66.55% -0.29%
==========================================
Files 22 22
Lines 2760 2775 +15
==========================================
+ Hits 1845 1847 +2
- Misses 915 928 +13
Continue to review full report at Codecov.
|
@@ -301,7 +301,8 @@ def connect(self): | |||
conn = self._new_conn() | |||
hostname = self.host | |||
|
|||
if self._tunnel_host: | |||
# Google App Engine's different HTTP lib may not define_tunnel_host. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need a space after "define": "define _tunnel_host".
@@ -171,7 +171,7 @@ def _new_conn(self): | |||
|
|||
def _prepare_conn(self, conn): | |||
self.sock = conn | |||
if self._tunnel_host: | |||
if getattr(self, '_tunnel_host', None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me, my only question is how do our tests not catch this?
Also should we add a comment here about why we're using getattr
to prevent this issue in the future?
@speedplane this PR still has outstanding comments. If you'd still like it merged, please let us know! I'm going to close it for now, though. |
urllib3 removed support for Python versions before 2.7 in a previous pull request, unfortunately, this broke environments that use a different implementation of httplib than the one in Python's standard library as well. This includes Google App Engine's urlfetch-based implementation (https://github.com/GoogleCloudPlatform/python-compat-runtime/blob/master/appengine-compat/exported_appengine_sdk/google/appengine/dist27/gae_override/httplib.py#L362) This pull request is nearly identical to urllib3#1504 which was closed due to its author not responding to comments. Fixes urllib3#1503
urllib3 removed support for Python versions before 2.7 in a previous pull request, unfortunately, this broke environments that use a different implementation of httplib than the one in Python's standard library as well. This includes Google App Engine's urlfetch-based implementation (https://github.com/GoogleCloudPlatform/python-compat-runtime/blob/master/appengine-compat/exported_appengine_sdk/google/appengine/dist27/gae_override/httplib.py#L362) This pull request is nearly identical to urllib3#1504 which was closed due to its author not responding to comments. Fixes urllib3#1503
App Engine does not have _tunnel_host set in its httplib implementation. Make sure we check for that. #1503. Note this reverts part of the change in #1430.