Skip to content

Commit 8566fb4

Browse files
committedApr 9, 2023
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.
1 parent 6dc4867 commit 8566fb4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/HttpClient.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ int HttpClient::responseStatusCode()
421421
{
422422
if (available())
423423
{
424-
c = read();
424+
c = HttpClient::read();
425425
if (c != -1)
426426
{
427427
switch(iState)
@@ -762,7 +762,7 @@ int HttpClient::read(uint8_t *buf, size_t size)
762762

763763
int HttpClient::readHeader()
764764
{
765-
char c = read();
765+
char c = HttpClient::read();
766766

767767
if (endOfHeadersReached())
768768
{

0 commit comments

Comments
 (0)
Please sign in to comment.