X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=docs%2Flibcurl%2Fopts%2FCURLOPT_CERTINFO.3;h=2333d9ae5f904863e3b85d3e7eb09543eb164ce4;hb=cfd75dcdb18d0a4291f48020211c65507a97d9eb;hp=e836e407d3a52094034995500a120df2ba385f6c;hpb=24b9957402f17c422eeeb3386bf049feeb342e78;p=platform%2Fupstream%2Fcurl.git diff --git a/docs/libcurl/opts/CURLOPT_CERTINFO.3 b/docs/libcurl/opts/CURLOPT_CERTINFO.3 index e836e40..2333d9a 100644 --- a/docs/libcurl/opts/CURLOPT_CERTINFO.3 +++ b/docs/libcurl/opts/CURLOPT_CERTINFO.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -20,7 +20,8 @@ .\" * .\" ************************************************************************** .\" -.TH CURLOPT_CERTINFO 3 "19 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options" +.TH CURLOPT_CERTINFO 3 "May 27, 2017" "libcurl 7.59.0" "curl_easy_setopt options" + .SH NAME CURLOPT_CERTINFO \- request SSL certificate information .SH SYNOPSIS @@ -38,7 +39,37 @@ its option \fICURLINFO_CERTINFO(3)\fP. .SH PROTOCOLS All TLS-based .SH EXAMPLE -TODO +.nf +curl = curl_easy_init(); +if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); + + /* connect to any HTTPS site, trusted or not */ + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + + curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L); + + res = curl_easy_perform(curl); + + if (!res) { + struct curl_certinfo *ci; + res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci); + + if (!res) { + printf("%d certs!\\n", ci->num_of_certs); + + for(i = 0; i < ci->num_of_certs; i++) { + struct curl_slist *slist; + + for(slist = ci->certinfo[i]; slist; slist = slist->next) + printf("%s\\n", slist->data); + } + } + } + curl_easy_cleanup(curl); +} +.fi .SH AVAILABILITY This option is supported by the OpenSSL, GnuTLS, NSS and GSKit backends. .SH RETURN VALUE