From 7da77fe5a1cc29a58e57fca338b1f66e0550033f Mon Sep 17 00:00:00 2001 From: yota22721 Date: Wed, 14 Dec 2022 12:05:35 +0900 Subject: [PATCH] Add client-tls-http.c example --- tls/client-tls-http.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tls/client-tls-http.c b/tls/client-tls-http.c index a3e6562c..c31879e0 100644 --- a/tls/client-tls-http.c +++ b/tls/client-tls-http.c @@ -134,20 +134,13 @@ int main(int argc, char** argv) goto cleanup; } - /* Initialize the buff */ - memset(buff, 0, sizeof(buff)); - - /* Copy HTTP GET request to the buff*/ - memcpy(buff,kHttpGetMsg,sizeof(kHttpGetMsg)); - - /* Buff length */ - len = strnlen(buff, sizeof(buff)); + /* kHttpGetMsg length */ + len = strnlen(kHttpGetMsg, sizeof(kHttpGetMsg)); /* Send HTTP GET request to the server */ printf("Sending HTTP GET request ...\n"); - - if ((ret = wolfSSL_write(ssl, buff, len)) != len) { - fprintf(stderr, "ERROR: failed to write entire message\n"); + if ((ret = wolfSSL_write(ssl, kHttpGetMsg, len)) != len) { + fprintf(stderr, "ERROR: failed to send HTTP GET request.\n"); fprintf(stderr, "%d bytes of %d bytes were sent", ret, (int) len); goto cleanup; }