1
0
mirror of https://github.com/arduino-libraries/ArduinoHttpClient.git synced 2025-06-07 07:42:01 +03:00

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.
This commit is contained in:
Tim Vandecasteele 2023-04-09 18:34:47 +02:00
parent 6dc4867478
commit 8566fb4cc0

View File

@ -421,7 +421,7 @@ int HttpClient::responseStatusCode()
{ {
if (available()) if (available())
{ {
c = read(); c = HttpClient::read();
if (c != -1) if (c != -1)
{ {
switch(iState) switch(iState)
@ -762,7 +762,7 @@ int HttpClient::read(uint8_t *buf, size_t size)
int HttpClient::readHeader() int HttpClient::readHeader()
{ {
char c = read(); char c = HttpClient::read();
if (endOfHeadersReached()) if (endOfHeadersReached())
{ {