Merge lp:~matsubara/ubuntu/trusty/python-urllib3/bug-1412545 into lp:ubuntu/trusty/python-urllib3

Proposed by Diogo Matsubara on 2015-01-26
Status: Merged
Merge reported by: Robie Basak
Merged at revision: not available
Proposed branch: lp:~matsubara/ubuntu/trusty/python-urllib3/bug-1412545
Merge into: lp:ubuntu/trusty/python-urllib3
Diff against target: 95 lines (+75/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/05_backport_proxy_fix.patch (+66/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~matsubara/ubuntu/trusty/python-urllib3/bug-1412545
Reviewer Review Type Date Requested Status
Robie Basak 2015-01-26 Needs Fixing on 2015-01-26
Review via email: mp+247593@code.launchpad.net

Description of the change

This is an attempt to backport the fix for bug LP #1412545.
The issue in the trusty version is that when users are behind a proxy and the
connection is dropped, the library stops using the proxy. The fix has been
committed on 1c30a1f3 python-urllib3 upstream code and released on 1.8.3.

To post a comment you must log in.
Robie Basak (racb) wrote :

Assuming the patch works, the packaging changes look good.

A few minor corrections:

Please use 1.7.1-1ubuntu0.1 as the version number from an SRU (taken from https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging, which is recommended from https://wiki.ubuntu.com/StableReleaseUpdates#Procedure).

Please can you add dep3 headers to the quilt patch? Described at http://dep.debian.net/deps/dep3/, these make it easier for other developers to track where the patch came from and what its current status is. I'm sorry if I failed to mention this in our Hangout.

Finally, please can you check step 3 in https://wiki.ubuntu.com/StableReleaseUpdates#Procedure? The SRU team will need this to process the upload, so we don't upload until all steps before step 5 are complete. As you backported the patch you're probably the best person to assess the potential for regressions and pass this information on the SRU team.

Thanks!

review: Needs Fixing
13. By Diogo Matsubara on 2015-01-27

review comments: fix package versioning, add dep3 headers to patch

Diogo Matsubara (matsubara) wrote :

Hi Robie,

thanks for the review!

> Assuming the patch works, the packaging changes look good.
>
> A few minor corrections:
>
> Please use 1.7.1-1ubuntu0.1 as the version number from an SRU (taken from
> https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Update_the_packaging,
> which is recommended from
> https://wiki.ubuntu.com/StableReleaseUpdates#Procedure).

Done.

>
> Please can you add dep3 headers to the quilt patch? Described at
> http://dep.debian.net/deps/dep3/, these make it easier for other developers to
> track where the patch came from and what its current status is. I'm sorry if I
> failed to mention this in our Hangout.

You did mention, I forgot to update it but have done so now.

>
> Finally, please can you check step 3 in
> https://wiki.ubuntu.com/StableReleaseUpdates#Procedure? The SRU team will need
> this to process the upload, so we don't upload until all steps before step 5
> are complete. As you backported the patch you're probably the best person to
> assess the potential for regressions and pass this information on the SRU
> team.

Done.

14. By Diogo Matsubara on 2015-01-28

review comments: fix dep3 headers

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-02-23 13:53:23 +0000
3+++ debian/changelog 2015-01-28 15:47:21 +0000
4@@ -1,3 +1,11 @@
5+python-urllib3 (1.7.1-1ubuntu0.1) UNRELEASED; urgency=medium
6+
7+ * debian/patches/05_backport_proxy_fix.patch: Backport upstream fix 1c30a1f3
8+ from 1.8.3 release. Fixes the issue when a dropped connection makes
9+ further connections ignore the proxy. (LP: #1412545)
10+
11+ -- Diogo Matsubara <diogo.matsubara@canonical.com> Mon, 26 Jan 2015 12:02:13 -0200
12+
13 python-urllib3 (1.7.1-1build1) trusty; urgency=medium
14
15 * Rebuild to drop files installed into /usr/share/pyshared.
16
17=== added file 'debian/patches/05_backport_proxy_fix.patch'
18--- debian/patches/05_backport_proxy_fix.patch 1970-01-01 00:00:00 +0000
19+++ debian/patches/05_backport_proxy_fix.patch 2015-01-28 15:47:21 +0000
20@@ -0,0 +1,66 @@
21+Description: Backport upstream fix to deal with dropped connections that
22+ ignore proxy settings.
23+Origin: backport, https://github.com/shazow/urllib3/commit/1c30a1f3a4af9591f480a338f75221bdf5ca48da
24+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-urllib3/+bug/1412545
25+
26+Index: trusty/urllib3/connectionpool.py
27+===================================================================
28+--- trusty.orig/urllib3/connectionpool.py 2015-01-26 11:59:47.871036000 -0200
29++++ trusty/urllib3/connectionpool.py 2015-01-26 12:01:56.137278695 -0200
30+@@ -122,6 +122,7 @@
31+ # Calls self._set_hostport(), so self.host is
32+ # self._tunnel_host below.
33+ self._tunnel()
34++ self.auto_open = 0
35+
36+ # Wrap socket using verification with the root certs in
37+ # trusted_root_certs
38+@@ -260,10 +261,18 @@
39+ if not six.PY3: # Python 2
40+ extra_params['strict'] = self.strict
41+
42+- return HTTPConnection(host=self.host, port=self.port,
43++ conn = HTTPConnection(host=self.host, port=self.port,
44+ timeout=self.timeout.connect_timeout,
45+ **extra_params)
46+
47++ # Backport fix LP #1412545
48++ if getattr(conn, '_tunnel_host', None):
49++ # TODO: Fix tunnel so it doesn't depend on self.sock state.
50++ conn._tunnel()
51++ # Mark this connection as not reusable
52++ conn.auto_open = 0
53++
54++ return conn
55+
56+ def _get_conn(self, timeout=None):
57+ """
58+@@ -295,6 +304,12 @@
59+ if conn and is_connection_dropped(conn):
60+ log.info("Resetting dropped connection: %s" % self.host)
61+ conn.close()
62++ if getattr(conn, 'auto_open', 1) == 0:
63++ # This is a proxied connection that has been mutated by
64++ # httplib._tunnel() and cannot be reused (since it would
65++ # attempt to bypass the proxy)
66++ conn = None
67++
68+
69+ return conn or self._new_conn()
70+
71+Index: trusty/urllib3/util.py
72+===================================================================
73+--- trusty.orig/urllib3/util.py 2015-01-26 11:59:47.871036000 -0200
74++++ trusty/urllib3/util.py 2015-01-26 12:01:56.141278695 -0200
75+@@ -479,8 +479,10 @@
76+ let the platform handle connection recycling transparently for us.
77+ """
78+ sock = getattr(conn, 'sock', False)
79+- if not sock: # Platform-specific: AppEngine
80++ if sock is False: # Platform-specific: AppEngine
81+ return False
82++ if sock is None: # Connection already closed (such as by httplib).
83++ return True
84+
85+ if not poll:
86+ if not select: # Platform-specific: AppEngine
87
88=== modified file 'debian/patches/series'
89--- debian/patches/series 2013-10-17 13:28:10 +0000
90+++ debian/patches/series 2015-01-28 15:47:21 +0000
91@@ -2,3 +2,4 @@
92 02_require-cert-verification.patch
93 03_no-setuptools.patch
94 04_relax_nosetests_options.patch
95+05_backport_proxy_fix.patch

Subscribers

People subscribed via source and target branches