Unverified Commit 7e40de22 authored by M Hotchin's avatar M Hotchin Committed by GitHub

Fixes #4435 - WiFiClient improperly treats zero data available for read as an error (#4448)

parent 1287c529
...@@ -105,7 +105,7 @@ public: ...@@ -105,7 +105,7 @@ public:
int read(uint8_t * dst, size_t len){ int read(uint8_t * dst, size_t len){
if(!dst || !len || (_pos == _fill && !fillBuffer())){ if(!dst || !len || (_pos == _fill && !fillBuffer())){
return -1; return _failed ? -1 : 0;
} }
size_t a = _fill - _pos; size_t a = _fill - _pos;
if(len <= a || ((len - a) <= (_size - _fill) && fillBuffer() >= (len - a))){ if(len <= a || ((len - a) <= (_size - _fill) && fillBuffer() >= (len - a))){
...@@ -346,6 +346,9 @@ int WiFiClient::read() ...@@ -346,6 +346,9 @@ int WiFiClient::read()
if(res < 0) { if(res < 0) {
return res; return res;
} }
if (res == 0) { // No data available.
return -1;
}
return data; return data;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment