mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.51k stars 1.6k forks source link

Wrap HTTPS SSL fallback redirects to HTTPS again #4510

Open gnail opened 5 years ago

gnail commented 5 years ago

In wrap.py when HTTPS connection fails the urlstring changes to HTTP. However, visiting the repository using HTTP automatically re-upgrades the connection to HTTPS, and would fail again due to the same reason and rendering the fallback useless.

Context: I'm behind a corporate proxy with HTTPS inspection so SSL certs will fail verification due to unknown CA.

pgallir commented 5 years ago

I had the same issue #4520 where I reported the error you would encounter in such conditions.

mcneish1 commented 5 years ago

Thirded.

To fix (by ignoring SSL errors, which may or may not be a good idea): Replace https://github.com/mesonbuild/meson/blob/2795f942bef680b0f050cc1f1001db26cab68bb9/mesonbuild/wrap/wrap.py#L71 with

sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS)
sslctx.verify_mode = ssl.CERT_NONE 
return urllib.request.urlopen(urlstring, timeout=req_timeout, context=sslctx)