summaryrefslogtreecommitdiffstats
path: root/apps/s_time.c
diff options
context:
space:
mode:
authorRoelof duToit <r@dutoit.za.net>2017-07-13 13:07:26 -0400
committerMatt Caswell <matt@openssl.org>2017-07-14 10:32:29 +0100
commitf32bf051cf1c376216bf4fec905fafebeb6ec2dc (patch)
treecb429b87310591c47a99083eb035657b5c50a681 /apps/s_time.c
parent4a60bb1898ca8271a6ae46e2e2e805879eb38931 (diff)
Retry SSL_read on ERROR_WANT_READ.
This resolves the retry issue in general, but also the specific case where a TLS 1.3 server sends a post-handshake NewSessionTicket message prior to appdata. Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3925)
Diffstat (limited to 'apps/s_time.c')
-rw-r--r--apps/s_time.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/s_time.c b/apps/s_time.c
index b10c7e1da7..6976c3ce9c 100644
--- a/apps/s_time.c
+++ b/apps/s_time.c
@@ -240,8 +240,8 @@ int s_time_main(int argc, char **argv)
www_path);
if (buf_len <= 0 || SSL_write(scon, buf, buf_len) <= 0)
goto end;
- while ((i = SSL_read(scon, buf, sizeof(buf))) > 0)
- bytes_read += i;
+ while ((i = SSL_read(scon, buf, sizeof(buf))) > 0 || SSL_get_error(scon, i) == SSL_ERROR_WANT_READ)
+ if (i > 0) bytes_read += i;
}
#ifdef NO_SHUTDOWN
SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);
@@ -297,7 +297,7 @@ int s_time_main(int argc, char **argv)
buf_len = BIO_snprintf(buf, sizeof(buf), fmt_http_get_cmd, www_path);
if (buf_len <= 0 || SSL_write(scon, buf, buf_len) <= 0)
goto end;
- while (SSL_read(scon, buf, sizeof(buf)) > 0)
+ while ((i = SSL_read(scon, buf, sizeof(buf))) > 0 || SSL_get_error(scon, i) == SSL_ERROR_WANT_READ)
continue;
}
#ifdef NO_SHUTDOWN
@@ -328,8 +328,8 @@ int s_time_main(int argc, char **argv)
www_path);
if (buf_len <= 0 || SSL_write(scon, buf, buf_len) <= 0)
goto end;
- while ((i = SSL_read(scon, buf, sizeof(buf))) > 0)
- bytes_read += i;
+ while ((i = SSL_read(scon, buf, sizeof(buf))) > 0 || SSL_get_error(scon, i) == SSL_ERROR_WANT_READ)
+ if (i > 0) bytes_read += i;
}
#ifdef NO_SHUTDOWN
SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);