Skip to content

Commit

Permalink
Make sure to use HttpClient when upgrading the connection for websockets
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tim-vandecasteele committed Apr 9, 2023
1 parent 6dc4867 commit 8566fb4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ int HttpClient::responseStatusCode()
{
if (available())
{
c = read();
c = HttpClient::read();
if (c != -1)
{
switch(iState)
Expand Down Expand Up @@ -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())
{
Expand Down

0 comments on commit 8566fb4

Please sign in to comment.