Skip to content

Commit 63d6de5

Browse files
committed
Merge remote-tracking branch 'remotes/esp8266/master' into docu
2 parents ad2a887 + 77428ba commit 63d6de5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

libraries/ESP8266WiFi/src/WiFiClientSecure.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern "C"
5050
#define SSL_DEBUG_OPTS 0
5151
#endif
5252

53-
#define SSL_RX_BUF_SIZE 1536
53+
#define SSL_RX_BUF_SIZE 4096
5454

5555
class SSLContext {
5656
public:
@@ -92,10 +92,12 @@ class SSLContext {
9292
}
9393

9494
int read(uint8_t* dst, size_t size) {
95-
if (size > _rxbuf->getSize()) {
95+
if (!_rxbuf->getSize()) {
9696
_readAll();
9797
}
98-
return _rxbuf->read(reinterpret_cast<char*>(dst), size);
98+
size_t available = _rxbuf->getSize();
99+
size_t will_read = (available < size) ? available : size;
100+
return _rxbuf->read(reinterpret_cast<char*>(dst), will_read);
99101
}
100102

101103
int read() {

0 commit comments

Comments
 (0)