X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=apps%2Fs_time.c;h=149107c554b5dbf1c11e4a65d82e95a0164d693c;hp=b10c7e1da7ae0c5422a1110167580defbe448006;hb=d420729b9e709b7a6fc227a073f526d86d8767e6;hpb=eee9552212ecc9e19bc09ea8a1b8428dc7394f45 diff --git a/apps/s_time.c b/apps/s_time.c index b10c7e1da7..149107c554 100644 --- a/apps/s_time.c +++ b/apps/s_time.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -17,8 +17,8 @@ #ifndef OPENSSL_NO_SOCK -#define USE_SOCKETS #include "apps.h" +#include "progs.h" #include #include #include @@ -240,8 +240,10 @@ 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 || + SSL_get_error(scon, i) == SSL_ERROR_WANT_WRITE) + if (i > 0) bytes_read += i; } #ifdef NO_SHUTDOWN SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); @@ -297,7 +299,9 @@ 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 || + SSL_get_error(scon, i) == SSL_ERROR_WANT_WRITE) continue; } #ifdef NO_SHUTDOWN @@ -328,8 +332,10 @@ 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 || + SSL_get_error(scon, i) == SSL_ERROR_WANT_WRITE) + if (i > 0) bytes_read += i; } #ifdef NO_SHUTDOWN SSL_set_shutdown(scon, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);