From 2f7827ba8f8e31eda0e15f3d51073329cf606323 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 29 Sep 2017 18:24:11 -0700 Subject: [PATCH] tools/upip: Upgrade to 1.2.2. TLS SNI support, fixes after making str.rstrip() behavior compliant. --- tools/upip.py | 2 +- tools/upip_utarfile.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/upip.py b/tools/upip.py index 7b85c718f2..411da49e8c 100644 --- a/tools/upip.py +++ b/tools/upip.py @@ -122,7 +122,7 @@ def url_open(url): s.connect(addr) if proto == "https:": - s = ussl.wrap_socket(s) + s = ussl.wrap_socket(s, server_hostname=host) if warn_ussl: print("Warning: %s SSL certificate is not validated" % host) warn_ussl = False diff --git a/tools/upip_utarfile.py b/tools/upip_utarfile.py index 65ce0bdca8..460ca2cd44 100644 --- a/tools/upip_utarfile.py +++ b/tools/upip_utarfile.py @@ -3,7 +3,7 @@ import uctypes # http://www.gnu.org/software/tar/manual/html_node/Standard.html TAR_HEADER = { "name": (uctypes.ARRAY | 0, uctypes.UINT8 | 100), - "size": (uctypes.ARRAY | 124, uctypes.UINT8 | 12), + "size": (uctypes.ARRAY | 124, uctypes.UINT8 | 11), } DIRTYPE = "dir" @@ -75,8 +75,8 @@ class TarFile: return None d = TarInfo() - d.name = str(h.name, "utf-8").rstrip() - d.size = int(bytes(h.size).rstrip(), 8) + d.name = str(h.name, "utf-8").rstrip("\0") + d.size = int(bytes(h.size), 8) d.type = [REGTYPE, DIRTYPE][d.name[-1] == "/"] self.subf = d.subf = FileSection(self.f, d.size, roundup(d.size, 512)) return d