Timeout support for websocket/webrepl
Reported here: https://github.com/orgs/micropython/discussions/10444
Webrepl constructs a websocket with BLOCKING_WRITE set. There's no timeout, so prints can hang.
webrepl: Allow the page to run from the device (over HTTP).
This is an attempt to solve the issue where the publicly-hosted webrepl on https://micropython.org/webrepl is currently non-functional due to the page being served via https, but attempting to connect to a device hosting a non-secure websocket. See #5266
The main details of this change are in the corresponding webrepl client PR -- https://github.com/micropython/webrepl/pull/70
This PR contains:
- Removes unused client_handshake from websocket_helper, and then merges the remainder of this file (server_handshake) into webrepl.py (to reduce firmware size).
- Adds the respond-as-HTTP handling to server_handshake to serve up the
<base><script>page. - Allow the static host to be configured in
webrepl_cfg.py(Consider making this part ofwebrepl_setupflow?)
For testing I've set the default host to https://gitcdn.link/cdn/jimmo/webrepl/webrepl-on-device/ to point to the files from the PR but this should be https://micropython.org/webrepl/ once deployed.