Skip to content

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

Merged
JohnDoee merged 2 commits intoJohnDoee:developfrom
gazpachoking:fix_error_reason
Mar 18, 2018
Merged

Don't crash when accessing SSLError.reason if it does not exist.#12
JohnDoee merged 2 commits intoJohnDoee:developfrom
gazpachoking:fix_error_reason

Conversation

@gazpachoking
Copy link
Copy Markdown
Contributor

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

It does not address this note #5 (comment) I think another ticket should be created if there is a problem with timeouts.

@JohnDoee
Copy link
Copy Markdown
Owner

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
Copy link
Copy Markdown
Contributor Author

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
Copy link
Copy Markdown
Owner

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
Copy link
Copy Markdown
Contributor Author

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
Copy link
Copy Markdown
Owner

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

@JohnDoee JohnDoee merged commit 3a0163a into JohnDoee:develop Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSLError has no attribute 'reason'

2 participants