Skip to content

Commit

Permalink
fix(httpc): Fix data read was less than expected (#10019)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Jul 15, 2024
1 parent 33c9552 commit 6bd3274
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libraries/HTTPClient/src/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ int HTTPClient::writeToStreamDataBlock(Stream * stream, int size)
// some time for the stream
delay(1);

int leftBytes = (readBytes - bytesWrite);
int leftBytes = (bytesRead - bytesWrite);

// retry to send the missed bytes
bytesWrite = stream->write((buff + bytesWrite), leftBytes);
Expand All @@ -1446,7 +1446,7 @@ int HTTPClient::writeToStreamDataBlock(Stream * stream, int size)

// count bytes to read left
if(len > 0) {
len -= readBytes;
len -= bytesRead;
}

delay(0);
Expand Down

3 comments on commit 6bd3274

@InnuendoPi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review this fix. In my tests, almost all connections to webserver were loaded incompletely.

@me-no-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lucasssvaz please test this. @InnuendoPi can you provide a bit more info on your setup?

@lucasssvaz
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested using the examples and could not find any issues. @InnuendoPi could you provide more information about the issues ?

Please sign in to comment.