JohnDoee / deluge-client

A very lightweight pure-python Deluge RPC Client
MIT License
87 stars 14 forks source link

Don't crash when accessing SSLError.reason if it does not exist. #12

Closed gazpachoking closed 6 years ago

gazpachoking commented 6 years ago

This fixes #5. Python < 2.7.9 does not have a reason attribute on an SSLError exception.

It does not address this note https://github.com/JohnDoee/deluge-client/issues/5#issuecomment-300279957 I think another ticket should be created if there is a problem with timeouts.

JohnDoee commented 6 years ago

I found the error code: 258 https://github.com/openssl/openssl/blob/346149c164605cf0e1b930d3f42a1f28f3babcae/include/openssl/sslerr.h#L730

It seems like it is found in the attribute errno

Since python 2.7.9 is only 4ish years old, it is probably still required to have support for this.

Can you please add support for that? I'll add an ancient python version to the test matrix (while adding support for the upcoming version auto-detection).

gazpachoking commented 6 years ago

Yeah, I found that code too, but I'm not sure how to reproduce the UNSUPPORTED_PROTOCOL error, so I couldn't verify that the error code actually came. Do you know how to reproduce?

JohnDoee commented 6 years ago

Not while connecting to deluge, my plan so far has been to (write and) run a small SSL server that it can't negotiate a working connection with. The original problem stems from some disparity in Debian.

gazpachoking commented 6 years ago

I added the check for errno. I left the 'reason' check in though as well, since I haven't confirmed we actually get that error number.

JohnDoee commented 6 years ago

Thanks, I've found it somewhat hard to actually reproduce the error. It only happens with certain setups and combinations of software.