Skip to content

Commit 2f7827b

Browse files
committed
tools/upip: Upgrade to 1.2.2.
TLS SNI support, fixes after making str.rstrip() behavior compliant.
1 parent bdc6e86 commit 2f7827b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

tools/upip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def url_open(url):
122122
s.connect(addr)
123123

124124
if proto == "https:":
125-
s = ussl.wrap_socket(s)
125+
s = ussl.wrap_socket(s, server_hostname=host)
126126
if warn_ussl:
127127
print("Warning: %s SSL certificate is not validated" % host)
128128
warn_ussl = False

tools/upip_utarfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# http://www.gnu.org/software/tar/manual/html_node/Standard.html
44
TAR_HEADER = {
55
"name": (uctypes.ARRAY | 0, uctypes.UINT8 | 100),
6-
"size": (uctypes.ARRAY | 124, uctypes.UINT8 | 12),
6+
"size": (uctypes.ARRAY | 124, uctypes.UINT8 | 11),
77
}
88

99
DIRTYPE = "dir"
@@ -75,8 +75,8 @@ def next(self):
7575
return None
7676

7777
d = TarInfo()
78-
d.name = str(h.name, "utf-8").rstrip()
79-
d.size = int(bytes(h.size).rstrip(), 8)
78+
d.name = str(h.name, "utf-8").rstrip("\0")
79+
d.size = int(bytes(h.size), 8)
8080
d.type = [REGTYPE, DIRTYPE][d.name[-1] == "/"]
8181
self.subf = d.subf = FileSection(self.f, d.size, roundup(d.size, 512))
8282
return d

0 commit comments

Comments
 (0)