-
Notifications
You must be signed in to change notification settings - Fork 33
Run on platforms without ssl #103
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
Conversation
|
The Should these both be done the same way (whichever of the two), or is there a reason to do them differently? |
|
The warning for hashlib can be overcome by installing the library in question. Installing ssl is not an option (other than creating a dummy ssl.py for example), so this would only be a forced print every time with no purpose. In fact I would argue that the warning for hashlib should be removed but I chose not to do it in this PR. It doesn't bring anything useful when not using websockets, and it's redundant with the error that will happen when trying to. In general such prints should not happen unless there's a "debug" or "verbose" option set somewhere. For SSL it would be also interesting in the future to support other implementations by injecting it as a dependency and import the necessary libraries only when desired, but that's way beyond the scope of this PR. |
27f5e16 to
3c1b8e1
Compare
The fix is good, but forgot to remove the non-guarded `from ssl import ...`
dhalbert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed one thing, removing the old from ssl import ...
I tested this on a Feather RP2040 + Ethernet FeatherWing. I had to change the Ethernet example and will submit a PR for that.
@Neradoc if my change looks good, go ahead and merge. Then I'll submit the other PR and we can release a new version.
Updating https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer to 4.7.0 from 4.6.4: > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#106 from dhalbert/update-ether-example > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#103 from Neradoc/work-when-no-ssl
Catch the errors when importing ssl, and raise an exception in Server init when https is set.
This will allow using httpserver on ESP32SPI with adafruit/Adafruit_CircuitPython_ESP32SPI#218
Fixes #102