http_server: adds WebSocket support

This commit adds the WebSocket support for esp_http_server
library. It mainly does:

- Handling WebSocket handshake
  - Parsing HTTP upgrade request
  - Reply the upgrade request
- Receive WebSocket packets
  - Parse header, decode to a struct
  - Unmask payload (if required)
- Send WebSocket frames
- Receive WebSocket frame
- Automatic control frame handling

Merges https://github.com/espressif/esp-idf/pull/4306
Closes https://github.com/espressif/esp-idf/issues/4819
This commit is contained in:
Jackson Ming Hu
2019-11-04 20:51:59 +11:00
committed by bot
parent 5172724092
commit e983042af2
8 changed files with 597 additions and 8 deletions

View File

@@ -281,7 +281,9 @@ bool httpd_sess_pending(struct httpd_data *hd, int fd)
if (sd->pending_fn) {
// test if there's any data to be read (besides read() function, which is handled by select() in the main httpd loop)
// this should check e.g. for the SSL data buffer
if (sd->pending_fn(hd, fd) > 0) return true;
if (sd->pending_fn(hd, fd) > 0) {
return true;
}
}
return (sd->pending_len != 0);