8000 Return 0 from readBytes when client read returns -1 · I-Connect/ArduinoHttpClient@ea05719 · GitHub
[go: up one dir, main page]

Skip to content

Commit ea05719

Browse files
committed
Return 0 from readBytes when client read returns -1
1 parent 39f9ac3 commit ea05719

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ArdHttpClient.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,11 @@ class HttpClient : public Client
338338
* this method is used i.e by Updater.writeStream()
339339
* */
340340
size_t readBytes(uint8_t* buf, size_t size) override {
341-
return iClient->read(buf, size);
341+
int result = iClient->read(buf, size);
342+
if (result < 0) {
343+
return 0;
344+
}
345+
return result;
342346
};
343347

344348
virtual int peek() {

0 commit comments

Comments
 (0)
0