The first lesson introduces libcurl

1. Reference
    libcurl Home https://curl.haxx.se/libcurl/
 
2. Introduction libcurl
     libcurl is a free, easy to use client transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP , IMAPS, LDAP, LDAPS, POP3 , POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP and other agreements. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user name + password authentication (Basic, Digest, NTLM, Negotiate , Kerberos), HTTP file, http proxy forwarding.

Compared to Boost asio network library has the following advantages
1) timeout simple
2) HTTP digest authentication has been achieved
3) HTTPS support is very good
4) HTTP interaction to achieve very good

3. Compile the static library
     after downloading a curl-7.61.0 source tarball, extract, into the projects \ Windows there are various versions of VS solutions currently using VS2015, into the VC14 folder, there are lib folder, the file is folder which contains a solution and a libcurl libcurl existing project (the project will be added to actual solutions). src folder contains a set of tools to generate programs. By default, all supported protocols will be compiled into a static library. By macro definition HTTP_ONLY, only the HTTP, HTTPS compiled into a static library

4.HTTPS support
     curl-7.32.0 (2013-08-12 00:17) version does not support HTTPS, and therefore need to upgrade to curl-7.61.0 (2018-07-11 08:01) version.
HTTPS currently carrying out development when he met curl_easy_perform after the function execution and returns CURLE_UNSUPPORTED_PROTOCOL error,
SSL protocol used is the code curl_easy_setopt (hnd, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2) ;

Tips
    curl command line depend on openssl library to use ssl and TLS. The current is generally believed TLSv1.1 and TLSv1.2 is safe, many https server only supports these two agreements is no longer supported TLSv1.0 and ssl. But openssl 1.0.1 is the only supported TLSv1.1 and TLSv1.2.
When SSL only appears in the code is defined as macro
enum {
  CURL_SSLVERSION_DEFAULT,
  CURL_SSLVERSION_TLSv1,
  CURL_SSLVERSION_SSLv2,
  CURL_SSLVERSION_SSLv3,
  CURL_SSLVERSION_LAST / * Never use, Keep Last * /
};
Description HTTPS protocol version does not support the need to upgrade version curl


Guess you like

Origin blog.51cto.com/fengyuzaitu/2433503