1. turl
用于测试访问时间
# turl www.myluoluo.com
turl(){
curl -w "
HTTP: %{http_code}
DNS: %{time_namelookup}s
redirect: %{time_redirect}s
time_connect: %{time_connect}s
time_appconnect: %{time_appconnect}s
time_pretransfer: %{time_pretransfer}s
time_starttransfer: %{time_starttransfer}s
size_download: %{size_download}bytes
speed_download: %{speed_download}B/s
----------
time_total: %{time_total}s
" -o /dev/null $*
}
2. curlhost
用户指定 ip 访问域名(代替 curl -H “Host: domain.com” 1.1.1.1),仅限 HTTP 80 请求
# curlhost www.myluoluo.com 1.1.1.1
curlhost(){
echo "curl --resolve $1:80:$2 http://$1 -vv"
curl --resolve $1:80:$2 http://$1 -vv
}
3. curlhostssl
用户指定 ip 访问域名,仅限 HTTPS 443 请求
# curlhostssl www.myluoluo.com 1.1.1.1
curlhostssl(){
echo "curl --resolve $1:443:$2 https://$1 -vv"
curl --resolve $1:443:$2 https://$1 -vv
}