-
Notifications
You must be signed in to change notification settings - Fork 175
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
base: master
Are you sure you want to change the base?
Conversation
tls/client-tls-http.c
Outdated
} | ||
|
||
/* Get a message for the server from stdin */ | ||
printf("Message for server: "); |
There was a problem hiding this comment.
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";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tls/client-tls-http.c
Outdated
@@ -0,0 +1,177 @@ | |||
/* client-tls-http.c | |||
* | |||
* Copyright (C) 2006-2022 wolfSSL Inc. |
There was a problem hiding this comment.
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
tls/client-tls-http.c
Outdated
|
||
/* socket includes */ | ||
#include <sys/socket.h> | ||
#include<netdb.h> |
There was a problem hiding this comment.
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>
tls/client-tls-http.c
Outdated
} | ||
|
||
/* Initialize the addrinfo struct with zero */ | ||
memset(&hints,0,sizeof(hints)); |
There was a problem hiding this comment.
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));
tls/client-tls-http.c
Outdated
char *service = "https"; /* using https */ | ||
|
||
/* Get a Domain IP address */ | ||
if(getaddrinfo(argv[1],service,&hints,&res) != 0){ |
There was a problem hiding this comment.
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
tls/client-tls-http.c
Outdated
/* 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); |
There was a problem hiding this comment.
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.
No description provided.