-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a bug in XAsyncSockets.py #98
Conversation
* IsSSL() - compare the instance of _socket with SSLContext instead of SSLSocket
This is still not entirely fixed, I ran into issues on my ESP32 because SSLSocket is still used a few lines below it. MicroWebSrv2/MicroWebSrv2/libs/XAsyncSockets.py Lines 835 to 838 in 7646c75
Replacing that will SSLContext as well (as actually checked in the function) works for me. |
Ok @DracoTomes, that means that in MicroPython you have "SSLContext" as a socket attribute, otherwise the IF wouldn't go any further. I know that the latest version of MicroPython implements SSL (TLS) with context and asynchronously, because this didn't exist before. But I haven't checked yet. So I guess you don't use SSL in MicroPython at all? |
The line "hasattr(ssl, 'SSLContext')" indicates that the system manages SSL "contexts". |
I'm running the newest 1.22.1 so it's probably something to do with the changes in newer version. |
@DracoTomes : But it should work now, shouldn't it? |
Oh yeah my bad. After implementing that change everything worked. |
👍🏻 |
The bug is in function IsSSL where the _socket object is tested to be an instance of SSLSocket. The correct is to test if the object is of class SSLContext.
#95
The SSLSocket attribute is not available in micropython for port esp32 and when initiating a simple GET crashes the server.
Unhandled exception in thread started by <bound_method>
Traceback (most recent call last):
File "MicroWebSrv2/libs/XAsyncSockets.py", line 131, in _processWaitEvents
File "MicroWebSrv2/libs/XAsyncSockets.py", line 587, in OnReadyForReading
File "MicroWebSrv2/libs/XAsyncSockets.py", line 830, in IsSSL
AttributeError: 'module' object has no attribute 'SSLSocket'