From e3a543ba1bfabfe8e5560f17837f55ec3625c278 Mon Sep 17 00:00:00 2001 From: Zhi Guan Date: Tue, 14 Feb 2023 22:24:54 +0800 Subject: [PATCH] Update tls12_client.c --- tools/tls12_client.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/tls12_client.c b/tools/tls12_client.c index 01fb10d8..b97f48d4 100644 --- a/tools/tls12_client.c +++ b/tools/tls12_client.c @@ -146,6 +146,19 @@ bad: fd_set fds; size_t sentlen; + if (!fgets(send_buf, sizeof(send_buf), stdin)) { + if (feof(stdin)) { + tls_shutdown(&conn); + goto end; + } else { + continue; + } + } + if (tls_send(&conn, (uint8_t *)send_buf, strlen(send_buf), &sentlen) != 1) { + fprintf(stderr, "%s: send error\n", prog); + goto end; + } + FD_ZERO(&fds); FD_SET(conn.sock, &fds); #ifdef WIN32