Skip to content

Commit ba61480

Browse files
committed
extmod/modussl: SSL_OK from ssl_read() means "no user data so far".
SSL_OK is numeric 0, and it's *not* an EOF. So, should keep reading.
1 parent 2534bfd commit ba61480

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

extmod/modussl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
8787

8888
while (o->bytes_left == 0) {
8989
mp_int_t r = ssl_read(o->ssl_sock, &o->buf);
90+
if (r == SSL_OK) {
91+
// SSL_OK from ssl_read() means "everything is ok, but there's
92+
// not user data yet. So, we just keep reading.
93+
continue;
94+
}
9095
if (r < 0) {
9196
if (r == SSL_CLOSE_NOTIFY || r == SSL_ERROR_CONN_LOST) {
9297
// EOF

0 commit comments

Comments
 (0)