hyper
hyper copied to clipboard
_ssl.c errors
en.wikipedia.org -> _ssl.c:733: The handshake operation timed out github.com, google.com, yandex.ru -> SSLError: [SSL: UNKNOWN_PROTOCOL] unknown protocol (_ssl.c:749) twitter.com -> SSLEOFError: EOF occured in violation of protocol (_ssl.c:749)
In all of these cases it's very hard to know without additional details what's going on. What version of Python and OpenSSL are you using?
Anaconda custom-py36_0 based on 4.4.0-np112py36_1 x86 (32 bit) (just fully updated that version) python 3.6.1.final.0
What about OpenSSL?
openssl 1.0.2l (as reported by conda list openssl)
Hrm. Can you show me some sample code that reproduces the issue?
https://pastebin.com/GRCYVVEd
Hrm, this is not obviously problematic. Are you familiar with Wireshark? If you are, it'd be helpful to see the pcap for one of these failing transactions.
You need to specify a port along with hostname.
--- t.original.py 2017-07-31 14:41:55.000000000 +0300
+++ t.fixed.py 2017-07-31 14:43:29.000000000 +0300
@@ -2,11 +2,13 @@
from urllib.parse import urlparse
from hyper import HTTPConnection
+default_port = dict(http=80, https=443)
+
def makeActualReq(uri, referer=None, maxRedirects=10):
if maxRedirects<=0:
raise Exception("Redirects limit reached")
u=urlparse(uri)
- with HTTPConnection(u.hostname, secure=(u.scheme=="https")) as conn:
+ with HTTPConnection(u.hostname, port=(u.port or default_port.get(u.scheme.lower())), secure=(u.scheme=="https")) as conn:
#print(u.path)
conn.request('GET', u.path)
resp=conn.get_response()
Thank you, it looks like HTTP11Connection should be modified.
Thanks for that tip @KostyaEsmukov It helped me here: https://github.com/Lukasa/hyper/issues/408#issuecomment-486232660
See this comment: https://github.com/Lukasa/hyper/pull/407#issuecomment-486234837
I was running pytest with hyper in Python 3.7 and was getting that SSL warning. But as soon as I installed ndg-httpsclient that (same) SSL error disappeared.