溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

linux-curl

發(fā)布時(shí)間:2020-07-20 11:07:20 來(lái)源:網(wǎng)絡(luò) 閱讀:443 作者:f1yinsky 欄目:建站服務(wù)器

curl是基于URL語(yǔ)法在命令行方式下工作的文件傳輸工具,它支持FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE及LDAP等協(xié)議。

curl支持HTTPS認(rèn)證,并且支持HTTP的POST、PUT等方法, FTP上傳, kerberos認(rèn)證,HTTP上傳,代理服務(wù)器, cookies, 用戶(hù)名/密碼認(rèn)證, 下載文件斷點(diǎn)續(xù)傳,上載文件斷點(diǎn)續(xù)傳,,http代理服務(wù)器管道( proxy tunneling), 甚至它還支持IPv6, socks5代理服務(wù)器,,通過(guò)http代理服務(wù)器上傳文件到FTP服務(wù)器等等,功能十分強(qiáng)大。

# curl的常用選項(xiàng):
     -A/--user-agent <string> 設(shè)置用戶(hù)代理發(fā)送給服務(wù)器
     -basic 使用HTTP基本認(rèn)證
     --tcp-nodelay 使用TCP_NODELAY選項(xiàng)
     -e/--referer <URL> 來(lái)源網(wǎng)址
     --cacert <file> CA證書(shū) (SSL)
     --compressed 要求返回是壓縮的格式
     -H/--header <line>自定義頭信息傳遞給服務(wù)器
     -I/--head 只顯示響應(yīng)報(bào)文首部信息
     --limit-rate <rate> 設(shè)置傳輸速度
     -u/--user <user[:password]>設(shè)置服務(wù)器的用戶(hù)和密碼
     -0/--http1.0 使用HTTP 1.0


#使用mod_deflate模塊壓縮頁(yè)面優(yōu)化傳輸速度

[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                                     #文本大?。?954 
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服務(wù)
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                                    #文檔大?。?991
Connection: close
Content-Type: text/html; charset=UTF-8


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI