美文网首页
curl命令查看http请求各个阶段

curl命令查看http请求各个阶段

作者: 平解技术控 | 来源:发表于2019-10-14 22:10 被阅读0次

一、常用命令

curl -so /dev/null -w '\n'time_namelookup:'\t'%{time_namelookup}'\n'time_connect:'\t\t'%{time_connect}'\n'time_appconnect:'\t'%{time_appconnect}'\n'time_starttransfer:'\t'%{time_starttransfer}'\n'time_total:'\t\t'%{time_total}'\n'time_redirect:'\t\t'%{time_redirect}'\n' 'https://www.baidu.com.com/' --resolve www.baidu.com:443:1.2.3.4

可以测试出来源站传输的时间有多长,

 --resolve 指定域名解析出来的IP地址

使用参数 -v还可以查看HTTP请求的过程,比如

-o /dev/null 将资源下载的/dev/null , 只查看请求过程,如果不加这个参数,屏幕会被下载的资源沾满,很多时候是乱码,无法看到想到的数据

curl https://www.baidu.com/img/bd_logo1.png -o /dev/null -v

看下curl -v带回来的信息

首先看下 Cache-Control 这个是静态资源在cdn节点的cache信息,这个信息说明资源在cdn节点上cache的时间长度,如果这个资源没有cache,这个字段为 no-cache 

相关文章

网友评论

      本文标题:curl命令查看http请求各个阶段

      本文链接:https://www.haomeiwen.com/subject/grilmctx.html