From 8566fb4cc0098ef2c91f080f5eb877eefa0e23b6 Mon Sep 17 00:00:00 2001 From: Tim Vandecasteele Date: Sun, 9 Apr 2023 18:34:47 +0200 Subject: [PATCH] Make sure to use HttpClient when upgrading the connection for websockets Using WebSocketClient::begin I got into problems where `status = responseStatusCode();` would be trying to read the HTTP header, but because both HttpClient and WebSocketClient have a read function, the read from WebSocketClient was used, which returns a bunch of gibberish. This caused the WebSocket to think that the connection was not successfully upgraded. --- src/HttpClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/HttpClient.cpp b/src/HttpClient.cpp index 1c73464..000c763 100644 --- a/src/HttpClient.cpp +++ b/src/HttpClient.cpp @@ -421,7 +421,7 @@ int HttpClient::responseStatusCode() { if (available()) { - c = read(); + c = HttpClient::read(); if (c != -1) { switch(iState) @@ -762,7 +762,7 @@ int HttpClient::read(uint8_t *buf, size_t size) int HttpClient::readHeader() { - char c = read(); + char c = HttpClient::read(); if (endOfHeadersReached()) {