Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fhessel/esp32_https_server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: gb-123-git/esp32_https_server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jan 23, 2022

  1. Update HTTPConnection.cpp #106 Possible Crash Fix

    Prevent crash on WebSocket request to non-WebSocket node. #106
    gb-123-git authored Jan 23, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4afc43a View commit details
Showing with 11 additions and 3 deletions.
  1. +11 −3 src/HTTPConnection.cpp
14 changes: 11 additions & 3 deletions src/HTTPConnection.cpp
Original file line number Diff line number Diff line change
@@ -519,9 +519,17 @@ void HTTPConnection::loop() {

// Finally, after the handshake is done, we create the WebsocketHandler and change the internal state.
if(websocketRequested) {
_wsHandler = ((WebsocketNode*)resolvedResource.getMatchingNode())->newHandler();
_wsHandler->initialize(this); // make websocket with this connection
_connectionState = STATE_WEBSOCKET;
HTTPNode *node = resolvedResource.getMatchingNode();

// Check for websocket request on non-websocket node:
if (node == nullptr || node->_nodeType != HTTPNodeType::WEBSOCKET) {
HTTPS_LOGW("Websocket request on non-websocket node rejected");
raiseError(404, "Not Found");
} else {
_wsHandler = ((WebsocketNode *) node)->newHandler();
_wsHandler->initialize(this); // make websocket with this connection
_connectionState = STATE_WEBSOCKET;
}
} else {
// Handling the request is done
HTTPS_LOGD("Handler function done, request complete");