linux-curl-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

linux-curl

curl是基于URL语法在命令行方式下工作的文件传输工具,它支持FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE及LDAP等协议。

目前创新互联已为超过千家的企业提供了网站建设、域名、网络空间、网站托管、企业网站设计、留坝网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

curl支持HTTPS认证,并且支持HTTP的POST、PUT等方法, FTP上传, kerberos认证,HTTP上传,代理服务器, cookies, 用户名/密码认证, 下载文件断点续传,上载文件断点续传,,http代理服务器管道( proxy tunneling), 甚至它还支持IPv6, socks5代理服务器,,通过http代理服务器上传文件到FTP服务器等等,功能十分强大。

# curl的常用选项:
     -A/--user-agent  设置用户代理发送给服务器
     -basic 使用HTTP基本认证
     --tcp-nodelay 使用TCP_NODELAY选项
     -e/--referer  来源网址
     --cacert  CA证书 (SSL)
     --compressed 要求返回是压缩的格式
     -H/--header 自定义头信息传递给服务器
     -I/--head 只显示响应报文首部信息
     --limit-rate  设置传输速度
     -u/--user 设置服务器的用户和密码
     -0/--http1.0 使用HTTP 1.0

#使用mod_deflate模块压缩页面优化传输速度

[root@bogon ~]# curl -I 192.168.1.33:80
HTTP/1.1 403 Forbidden
Date: Mon, 10 Jul 2017 00:46:21 GMT
Server: Apache/2.2.15 (CentOS)
Accept-Ranges: bytes
Content-Length: 4954                                     #文本大小:4954 
Connection: close
Content-Type: text/html; charset=UTF-8                   #text/html格式



#/etc/httpd/conf/httpd.conft添加deflate压缩模块
 SetOutputFilter DEFLATE

 # mod_deflate configuration 
  
  # Restrict compression to these MIME types
  AddOutputFilterByType DEFLATE text/plain 
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/css
  
  # Level of compression (Highest 9 - Lowest 1)
  DeflateCompressionLevel 9
   
  # Netscape 4.x has some problems.
  BrowserMatch ^Mozilla/4 gzip-only-text/html
   
  # Netscape 4.06-4.08 have some more problems
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
   
  # MSIE masquerades as Netscape, but it is fine
  BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
  

[root@bogon ~]# service httpd reload                    #重启httpd服务
Reloading httpd: 
[root@bogon ~]# curl -I --compressed  192.168.1.33:80
HTTP/1.1 403 Forbidden
Date: Mon, 10 Jul 2017 00:46:59 GMT
Server: Apache/2.2.15 (CentOS)
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip                                  #gzip格式
Content-Length: 1991                                    #文档大小:1991
Connection: close
Content-Type: text/html; charset=UTF-8

文章名称:linux-curl
网站链接:http://kswsj.cn/article/poecej.html

其他资讯