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

Fix App Engine Tunnel Host #1504

Closed
wants to merge 1 commit into from

Conversation

speedplane
Copy link

@speedplane speedplane commented Dec 19, 2018

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.

…on. Make sure we check for that. urllib3#1503. Not this reverts part of the change in urllib3#1430.
@codecov-io
Copy link

codecov-io commented Dec 19, 2018

Codecov Report

Merging #1504 into master will decrease coverage by 0.28%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/urllib3/connection.py 53.28% <66.66%> (-2.46%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f80ff34...ae7f612. Read the comment docs.

@@ -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.
Copy link
Member

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):
Copy link
Member

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?

@theacodes
Copy link
Member

@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.

@theacodes theacodes closed this Jan 22, 2019
jpevarnek added a commit to jpevarnek/urllib3 that referenced this pull request Jan 24, 2019
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
jpevarnek added a commit to jpevarnek/urllib3 that referenced this pull request Jan 24, 2019
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
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.

None yet

6 participants