Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added client-tls-http.c example #353

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

yota22721
Copy link

No description provided.

@kojo1 kojo1 self-requested a review December 14, 2022 01:51
}

/* Get a message for the server from stdin */
printf("Message for server: ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it send an HTTP GET request instead of a user message from stdin?
It would fine with hard coded like
HttpGetMsg[] = "GET /index.html HTTP/1.0\r\n\r\n";

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to sending HTTP GET request from sending user message here 746bf5f
After 746bf5f commit, I realized some of the code is meaningless, so here is the latest commit 7da77fe

@kojo1 kojo1 requested a review from cconlon December 15, 2022 00:25
@yota22721 yota22721 requested review from kojo1 and removed request for cconlon December 15, 2022 03:27
@kojo1 kojo1 requested a review from cconlon December 15, 2022 04:12
@cconlon cconlon self-assigned this Mar 8, 2023
@@ -0,0 +1,177 @@
/* client-tls-http.c
*
* Copyright (C) 2006-2022 wolfSSL Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright should be updated to 2023


/* socket includes */
#include <sys/socket.h>
#include<netdb.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space after #include and before <netdb.h>

}

/* Initialize the addrinfo struct with zero */
memset(&hints,0,sizeof(hints));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space after commas, thanks. For example:

memset(&hints, 0, sizeof(hints));

char *service = "https"; /* using https */

/* Get a Domain IP address */
if(getaddrinfo(argv[1],service,&hints,&res) != 0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add spaces after commas here too, thanks

/* Connect to wolfSSL on the server side */
if ((ret = wolfSSL_connect(ssl)) != SSL_SUCCESS) {
fprintf(stderr, "ERROR: failed to connect to wolfSSL\n");
printf("%d\n",ret);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need this printf for ret. On failure, wolfSSL_connect will just return SSL_FAILURE. If you want to print the specific error, please call wolfSSL_get_error(ssl, ret), then print out the return of that function.

@cconlon cconlon assigned yota22721 and unassigned cconlon Mar 17, 2023
@yota22721 yota22721 requested review from cconlon and removed request for kojo1 March 29, 2023 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants