Skip to content

Commit

Permalink
Add client-tls-http.c example
Browse files Browse the repository at this point in the history
  • Loading branch information
yota22721 committed Dec 14, 2022
1 parent 746bf5f commit 7da77fe
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions tls/client-tls-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7da77fe

Please sign in to comment.