Skip to content

Commit 1f91189

Browse files
committed
upip: Be sure to close socket if we abort with error early.
Need to close properly in more places.
1 parent a86e7cf commit 1f91189

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

upip/upip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,15 @@ def url_open(url):
127127
l = s.readline()
128128
protover, status, msg = l.split(None, 2)
129129
if status != b"200":
130+
s.close()
130131
exc = ValueError(status)
131132
if status == b"404":
132133
fatal("Package not found", exc)
133134
fatal("Unexpected error querying for package", exc)
134135
while 1:
135136
l = s.readline()
136137
if not l:
138+
s.close()
137139
fatal("Unexpected EOF in HTTP headers", ValueError())
138140
if l == b'\r\n':
139141
break

0 commit comments

Comments
 (0)