2019年7月7日 星期日

Use curl to confirm that images are using gzip

Use curl to confirm that images are using gzip

#!/bin/bash

PCHOME_URL='https://a.ecimg.tw/css/2016/style/images/v201607/mobile/v1.9/mobile_loading.svg'
MOMO_URL='https://image.momoshop.com.tw/ecm/img/de/0/bt_0_042/twcaseal_small1.jpg'


for URLs in ${PCHOME_URL} ${MOMO_URL}
do

    echo "\033[33;44m Check Respones Headers \033[0m"
    curl -H "Cache-Control: no-cache" -H "Accept-Encoding:  gzip, deflate, br" -Is ${URLs}
    echo "\033[33;44m Check content-length \033[0m"
    curl -H "Cache-Control: no-cache" -H "Accept-Encoding:  gzip, deflate, br" -Is ${URLs} | awk '/content-length/ {print $2}'
done
Reference:

沒有留言:

張貼留言