upip: Print warning about not validatng PyPI SSL certificate.

Suggested by upstream (CPython).
pull/75/head
Paul Sokolovsky 2016-05-27 00:27:28 +03:00
rodzic 2af1194b71
commit 6cd414e0b5
1 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -112,7 +112,9 @@ def expandhome(s):
try:
import ussl
import usocket
warn_ussl = True
def download(url, local_name):
global warn_ussl
proto, _, host, urlpath = url.split('/', 3)
ai = usocket.getaddrinfo(host, 443)
#print("Address infos:", ai)
@ -124,6 +126,9 @@ try:
if proto == "https:":
s = ussl.wrap_socket(s)
if warn_ussl:
print("Warning: %s SSL certificate is not validated" % host)
warn_ussl = False
# MicroPython rawsocket module supports file interface directly
s.write("GET /%s HTTP/1.0\r\nHost: %s\r\n\r\n" % (urlpath, host))