SSL socket fails with OSError: -30592
-
Hello!
I am trying to connect to a node.js server on a ZEIT instance, zeit.co. ZEIT handles the SSL through an nginx proxy ( I think ). My following code works when connecting to google but not the ZEIT server.
I get a weird error code:
Traceback (most recent call last): File "main.py", line 146, in networkThread File "main.py", line 54, in connectToService OSError: -30592line 54 is the
ss.connect(...)line, Here is my connection code:def connectToService(): global socketQueue global serialQueue print("Creating Socket...") ss = socket.socket() print("Wrapping Socket...") ss = ssl.wrap_socket(ss) print("Connecting...") #this next line works #ss.connect(socket.getaddrinfo('www.google.com', 443)[0][-1]) #this line does not ss.connect(socket.getaddrinfo('thismeshserver-fhprkttlyv.now.sh', 443)[0][-1]) print("Get...") cl = ss.makefile() buf = b"" buf += "GET / HTTP/1.0\r\n" buf += "\r\n" cl.write(buf) while 1: l = cl.readline() print(l) if l == b"\r\n": break ss.close()Where do I lookup the -30592 error?
Any other insight appreciated!
Thank you in advance.
-
@peterson79, have you solved the error?
I'm facing similar problem while using SSL.
-
I haven't found a solution, a standard connection seems to work through a dedicated server but not though ZEIT. Probably due to some proxy or load balancer would be my guess... I haven't found a way to lookup the error either...
-
You have to translate the error code to hex and search for it on the mbed tls implementation:
https://tls.mbed.org/api/ssl_8h.html#acc37a34787c5c5484a993ff64c3a163430592 is 0x7780
Which meansA fatal alert message was received from our peer.honestly I have no clue what this message implies ...
-
@peterson79 said in SSL socket fails with OSError: -30592:
ss = ssl.wrap_socket(ss)
BTW: have you tried adding parameters to this call? Like, do you need to supplie a client cert, or does the server require you to use SNI?
See the docs here:
https://docs.pycom.io/chapter/firmwareapi/micropython/ussl.htmlRegarding SNI there is an undocumented keyword parameter
server_hostnamesee my post here: https://forum.pycom.io/topic/2065/sni-on-tls-connections/2Finally: If you intend to do an http request consider using urequests from here: https://github.com/micropython/micropython-lib/tree/master/urequests
-
@this-wiederkehr I think it the same way as you do. There is no parameter named as server_hostname in the docs.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login