D5950: url: always access req._tunnel_host
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Tue Feb 12 17:37:25 EST 2019
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
The getattr() was there to handle Python versions before 2.6, which
lacked this attribute.
We /might/ be able to further delete some code here. However, the
behavior here is extremely hard to follow because large parts of
this code duplicate code from the Python standard library and it
is difficult to understand what is actually needed.
diff --git a/mercurial/url.py b/mercurial/url.py
@@ -179,10 +179,10 @@
-# general transaction handler to support different ways to handle
-# HTTPS proxying before and after Python 2.6.3.
+# Large parts of this function have their origin from before Python 2.6
+# and could potentially be removed.
def _generic_start_transaction(handler, h, req):
- tunnel_host = getattr(req, '_tunnel_host', None)
+ tunnel_host = req._tunnel_host
if tunnel_host[:7] not in ['http://', 'https:/']:
tunnel_host = 'https://' + tunnel_host
To: indygreg, #hg-reviewers
More information about the Mercurial-devel