[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 125/163: CURLINFO_TLS_SSL_PTR.3: improve the exampl
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 125/163: CURLINFO_TLS_SSL_PTR.3: improve the example |
Date: |
Sun, 05 Aug 2018 12:37:31 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 24cb114c53bd60495920c1aa3455290ea4b624dd
Author: Adrian Peniak <address@hidden>
AuthorDate: Thu Jun 28 06:56:16 2018 +0100
CURLINFO_TLS_SSL_PTR.3: improve the example
The previous example was a little bit confusing, because SSL* structure
(or other "in use" SSL connection pointer) is not accessible after the
transfer is completed, therefore working with the raw TLS library
specific pointer needs to be done during transfer.
Closes #2690
---
docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3 | 35 ++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3
b/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3
index 59ddd599c..c601e4fcf 100644
--- a/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3
+++ b/docs/libcurl/opts/CURLINFO_TLS_SSL_PTR.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <address@hidden>, et al.
+.\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <address@hidden>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -129,14 +129,33 @@ https://github.com/curl/curl/issues/685
All TLS-based
.SH EXAMPLE
.nf
-CURL *curl = curl_easy_init();
-if(curl) {
+#include <curl/curl.h>
+#include <openssl/ssl.h>
+
+CURL *curl;
+static size_t wf(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+ const struct curl_tlssessioninfo *info = NULL;
+ CURLcode res = curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &info);
+ if(info && !res) {
+ if(CURLSSLBACKEND_OPENSSL == info->backend) {
+ printf("OpenSSL ver. %s\\n", SSL_get_version((SSL*)info->internals));
+ }
+ }
+ return size * nmemb;
+}
+
+int main(int argc, char** argv)
+{
CURLcode res;
- struct curl_tlssessioninfo *tls;
- curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
- res = curl_easy_perform(curl);
- curl_easy_getinfo(curl, CURLINFO_TLS_SSL_PTR, &tls);
- curl_easy_cleanup(curl);
+ curl = curl_easy_init();
+ if(curl) {
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, wf);
+ res = curl_easy_perform(curl);
+ curl_easy_cleanup(curl);
+ }
+ return res;
}
.fi
.SH AVAILABILITY
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 116/163: include/README: remove "hacking" advice, not the right place, (continued)
- [GNUnet-SVN] [gnurl] 116/163: include/README: remove "hacking" advice, not the right place, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 118/163: GOVERNANCE: add maintainer details/duties, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 113/163: netrc: use a larger buffer, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 103/163: maketgz: delete .bak files, fix indentation, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 97/163: CURLOPT_HTTPAUTH.3: CURLAUTH_BEARER was added in 7.61.0, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 148/163: examples: fix -Wformat warnings, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 131/163: telnet: fix clang warnings, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 137/163: RELEASE-NOTES: synced, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 127/163: RELEASE-NOTES: synced, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 147/163: smtp: use the upload buffer size for scratch buffer malloc, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 125/163: CURLINFO_TLS_SSL_PTR.3: improve the example,
gnunet <=
- [GNUnet-SVN] [gnurl] 160/163: gnurl: post-merge adjustments, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 152/163: schannel: fix -Wsign-compare warning, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 151/163: schannel: workaround for wrong function signature in w32api, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 158/163: release: 7.61.0, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 155/163: CMake: remove redundant and old end-of-block syntax, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 115/163: RELEASE-NOTES: synced, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 145/163: darwinssl: allow High Sierra users to build the code using GCC, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 141/163: libssh: goto DISCONNECT state on error, not SSH_SESSION_FREE, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 130/163: docs: fix missed option name markups, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 156/163: post303.d: clarify that this is an RFC violation, gnunet, 2018/08/05