kopia lustrzana https://github.com/micropython/micropython-lib
upip: Be sure to close socket if we abort with error early.
Need to close properly in more places.pull/158/head
rodzic
a86e7cf5a7
commit
1f91189e04
|
@ -127,6 +127,7 @@ def url_open(url):
|
||||||
l = s.readline()
|
l = s.readline()
|
||||||
protover, status, msg = l.split(None, 2)
|
protover, status, msg = l.split(None, 2)
|
||||||
if status != b"200":
|
if status != b"200":
|
||||||
|
s.close()
|
||||||
exc = ValueError(status)
|
exc = ValueError(status)
|
||||||
if status == b"404":
|
if status == b"404":
|
||||||
fatal("Package not found", exc)
|
fatal("Package not found", exc)
|
||||||
|
@ -134,6 +135,7 @@ def url_open(url):
|
||||||
while 1:
|
while 1:
|
||||||
l = s.readline()
|
l = s.readline()
|
||||||
if not l:
|
if not l:
|
||||||
|
s.close()
|
||||||
fatal("Unexpected EOF in HTTP headers", ValueError())
|
fatal("Unexpected EOF in HTTP headers", ValueError())
|
||||||
if l == b'\r\n':
|
if l == b'\r\n':
|
||||||
break
|
break
|
||||||
|
|
Ładowanie…
Reference in New Issue