Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions cores/esp8266/StreamString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@

size_t StreamString::write(const uint8_t *buffer, size_t size) {
if(reserve(length() + size + 1)) {
for(size_t i = 0; i < size; i++) {
if(write(*buffer)) {
buffer++;
} else {
return i;
}
}

const uint8_t *s = buffer;
const uint8_t *end = buffer + size;
while(write(*s++) && s < end);
return s - buffer;
}
return 0;
}
Expand Down
14 changes: 12 additions & 2 deletions libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,12 @@ int HTTPClient::sendRequest(const char * type, Stream * stream, size_t size) {
int c = stream->readBytes(buff, ((s > buff_size) ? buff_size : s));

// write it to Stream
bytesWritten += _tcp->write((const uint8_t *) buff, c);
int w = _tcp->write((const uint8_t *) buff, c);
if(w != c) {
DEBUG_HTTPCLIENT("[HTTP-Client][sendRequest] short write asked for %d but got %d\n", c, w);
break;
}
bytesWritten += c;

if(len > 0) {
len -= c;
Expand Down Expand Up @@ -470,7 +475,12 @@ int HTTPClient::writeToStream(Stream * stream) {
int c = _tcp->readBytes(buff, ((size > buff_size) ? buff_size : size));

// write it to Stream
bytesWritten += stream->write(buff, c);
int w = stream->write(buff, c);
if(w != c) {
DEBUG_HTTPCLIENT("[HTTP-Client][writeToStream] short write asked for %d but got %d\n", c, w);
break;
}
bytesWritten += c;

if(len > 0) {
len -= c;
Expand Down