python-hyper / hyper

HTTP/2 for Python.
http://hyper.rtfd.org/en/latest/
MIT License
1.05k stars 192 forks source link

Is there a way to disable server certificate validation? #340

Closed xianglisegue closed 7 years ago

xianglisegue commented 7 years ago

Hi, I am trying to use HTTP20Adapter with Requests. With Requests, I can simply use verify=False to disable validating server certificate, but it seems I can't figure out how to achieve this with HTTP20Adapter.

Looking at the source, HTTP20Adapter initializes a ssl_context, depends on the value of "cert" passed in.

SSLContext

Create a new SSLContext that is correctly set up for an HTTP/2 connection. This SSL context object can be customized and passed as a parameter to the HTTPConnection class. Provide your own certificate file in case you don’t want to use hyper’s default certificate. The path to the certificate can be absolute or relative to your working directory.

cert_path – (optional) The path to the certificate file of “certification authority” (CA) certificates

It seems to me I can either use hyper's CA or my own, but can't disable it?

Thank you very much for the help -Xiang

Lukasa commented 7 years ago

The current master branch has this support: try running pip install -U git+https://github.com/Lukasa/hyper.git and see if that resolves your issue.

xianglisegue commented 7 years ago

Yes, now the ‘verify=False’ option used in Requests’ session object appears to be working fine with HTTP20Adapter after the update!

Thank you very much for the help!

-Xiang

From: Cory Benfield [mailto:notifications@github.com] Sent: Friday, July 7, 2017 2:12 AM To: Lukasa/hyper hyper@noreply.github.com Cc: xianglisegue xiangli@seguesoft.com; Author author@noreply.github.com Subject: Re: [Lukasa/hyper] Is there a way to disable server certificate validation? (#340)

The current master branch has this support: try running pip install -U git+https://github.com/Lukasa/hyper.git and see if that resolves your issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Lukasa/hyper/issues/340#issuecomment-313605703 , or mute the thread https://github.com/notifications/unsubscribe-auth/ARwc4VDzkD0L9rG2gG4MFA_U4rsLNtmDks5sLdoxgaJpZM4OQkFs . https://github.com/notifications/beacon/ARwc4ecvT6XOKGtJ2gT8aqNK0GSmUpkDks5sLdoxgaJpZM4OQkFs.gif