curl下载安装与使用
curl-安装与使用
-:
url
D:\AppCache\GolangHome\src\learn>curl apple.com#===============================================================D:\AppCache\GolangHome\src\learn>curl google.com52) Empty reply from server#===============================================================D:\AppCache\GolangHome\src\learn>curl xiaomi.com
301 Moved Permanently
Powered by MiWeb#==============================================================D:\AppCache\GolangHome\src\learn>curl baidu.com #===================================================================D:\AppCache\GolangHome\src\learn>
分别测试了苹果、谷歌、小米、百度。发现获得的页面内容大小相差较大。苹果啥也不给,霸道。谷歌则给了一句温馨提示语。小米则简洁地回应了一个html,重定向了。百度则回应一堆信息。
2、获取-I 301 Moved PermanentlyServer: GHostContent-Length: 0Location: max-age=0Expires: Sun, 22 Sep 2019 04:59:29 GMTDate: Sun, 22 Sep 2019 04:59:29 GMTConnection: keep-alivestrict-transport-security: max-age=31536000Set-Cookie: geo=CN; path=/; domain=.apple.comSet-Cookie: ccl=shCgHjtuYBarTIycW/rvIg==; path=/; domain=.apple.com#===================================================================D:\AppCache\GolangHome\src\learn>curl -I (52) Empty reply from server#====================================================================D:\AppCache\GolangHome\src\learn>curl -I 301 Moved PermanentlyServer: nginxDate: Sun, 22 Sep 2019 04:59:53 GMTContent-Type: text/htmlContent-Length: 223Connection: closeLocation: -I 200 OKServer: bfe/1.0.8.18Date: Sun, 22 Sep 2019 05:00:01 GMTContent-Type: text/htmlContent-Length: 277Last-Modified: Mon, 13 Jun 2016 02:50:23 GMTConnection: Keep-AliveETag: "575e1f6f-115"Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transformPragma: no-cacheAccept-Ranges: bytes#==========================================================================D:\AppCache\GolangHome\src\learn>
这次谷歌给的响应头依然是一句简短的提示语,太节约资源了。其他三个则普通给出响应头,其中苹果和小米都重定向了。
4、同时给出-i (52) Empty reply from server#===============================================================D:\AppCache\GolangHome\src\learn>curl -i 301 Moved PermanentlyServer: GHostContent-Length: 0Location: max-age=0Expires: Sun, 22 Sep 2019 05:10:26 GMTDate: Sun, 22 Sep 2019 05:10:26 GMTConnection: keep-alivestrict-transport-security: max-age=31536000Set-Cookie: geo=CN; path=/; domain=.apple.comSet-Cookie: ccl=Pnj18CxjBB4h7LQaKIIkxg==; path=/; domain=.apple.com#=====================================================================D:\AppCache\GolangHome\src\learn>curl -i 301 Moved PermanentlyServer: nginxDate: Sun, 22 Sep 2019 05:10:35 GMTContent-Type: text/htmlContent-Length: 223Connection: closeLocation: HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
301 Moved Permanently
Powered by MiWeb#=============================================================D:\AppCache\GolangHome\src\learn>curl -i 200 OKServer: bfe/1.0.8.18Date: Sun, 22 Sep 2019 05:10:47 GMTContent-Type: text/htmlContent-Length: 2381Last-Modified: Mon, 23 Jan 2017 13:28:12 GMTConnection: Keep-AliveETag: "588604ec-94d"Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transformPragma: no-cacheSet-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/Accept-Ranges: bytes #====================================================D:\AppCache\GolangHome\src\learn>
谷歌依旧发挥着极简风格,就一句话。苹果给头不给体。小米则都给。百度则臃肿不堪。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~