cURL 7.49.0最近发布,cURL是利用URL语法在命令行方式下工作的开源文件传输工具。支持DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP。
cURL支持SSL证书,HTTP POST,HTTP PUT,FTP上传,基于HTTP的形式上传,代理,cookies,用户+密码验证(基本,摘要,NTLM,协商,Kerberos...),文件传输简历,代理隧道和总线负载。
cURL 7.49.0 更新日志
变化:
schannel: Add ALPN support
SSH: support CURLINFO_FILETIME
SSH: new CURLOPT_QUOTE command “statvfs”
wolfssl: Add ALPN support
http2: added –http2-prior-knowledge
http2: added CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE
libcurl: added CURLOPT_CONNECT_TO
curl: added –connect-to
libcurl: added CURLOPT_TCP_FASTOPEN
curl: added –tcp-fastopen
curl: remove support for –ftpport, -http-request and –socks
Bug修复:
CVE-2016-3739: TLS certificate check bypass with mbedTLS/PolarSSL
checksrc.bat: Updated the help to be consistent with generate.bat
checksrc.bat: Added support for scanning the tests and examples
openssl: fix ERR_remove_thread_state() for boringssl/libressl
openssl: boringssl provides the same numbering as openssl
multi: fix “Operation timed out after” timer
url: don’t use bad offset in tld_check_name to show error
sshserver.pl: use quotes for given options
Makefile.am: skip the scripts dir
curl: warn for –capath use if not supported by libcurl
http2: fix connection reuse
GSS: make Curl_gss_log_error more verbose
build-wolfssl: Allow a broader range of ciphers (Visual Studio)
wolfssl: Use ECC supported curves extension
openssl: Fix compilation warnings
还有很多:http://curl.haxx.se/changes.html
Ubuntu 16.04 及衍生版安装 cURL 7.49.0
wget http://curl.haxx.se/download/curl-7.49.0.tar.gz
tar -xvf curl-7.49.0.tar.gz
cd curl-7.49.0/./configure
make
sudo make install
curl(文件传输工具)常用参数如下:
-c,--cookie-jar:将cookie写入到文件
-b,--cookie:从文件中读取cookie
-C,--continue-at:断点续传
-d,--data:http post方式传送数据
-D,--dump-header:把header信息写入到文件
-F,--from:模拟http表达提交数据
-s,--slient:减少输出信息
-o,--output:将信息输出到文件
-O,--remote-name:按照服务器上的文件名,存在本地
--l,--head:仅返回头部信息
-u,--user[user:pass]:设置http认证用户和密码
-T,--upload-file:上传文件
-e,--referer:指定引用地址
-x,--proxy:指定代理服务器地址和端口
-w,--write-out:输出指定格式内容
--retry:重试次数
--connect-timeout:指定尝试连接的最大时间/s
使用示例:
例1:抓取页面到指定文件,如果有乱码可以使用iconv转码
# curl -o linux.html www.linux.com
# curl –s –o linux.html www.linux.com |iconv -f utf-8 #减少输出信息
例2:获取HTTP响应头headers
# curl -I http://www.linux.com
# curl -D ./header.txt http://www.linux.com #将headers保存到文件中