Search

11/02/2011

Check if gzip is enabled

Check if gzip is enabled

curl -I -H "Accept-Encoding: gzip,deflate" "$URL" --silent | grep -i "Content-Encoding:"

# OR
curl -H "Accept-Encoding: gzip,deflate" "$URL" --silent --write-out "%{size_download}" --output /dev/null
curl "$URL" --silent --write-out "%{size_download}" --output /dev/null
# 2nd must be greater the 1st


function check_compression {
local unzipped=`curl "$1" --silent --write-out "%{size_download}" --output /dev/null`
local zipped=`curl -H "Accept-Encoding: gzip,deflate" "$1" --silent --write-out "%{size_download}" --output /dev/null`
echo "unzipped size: $unzipped, zipped size: $zipped"
}


telnet l.yimg.com 80
GET /f/a/tw/js/flash_general_20090213.js HTTP/1.1
HOST: l.yimg.com

response:
function yad_ad_090213(e,q,t,o,g,m,l,s,h,d,a){var f=window.location.href;if(e&&q&&t&&o&&g&&m&&l&&s&&h&&d&&a){if(typeof(this["yad_plugin_flash"+d])=="undefined"){var b=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var c=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var p=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;yad_ControlVersion=function(){var v=-1,w,u;try{w=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.8");v=w.GetVariable("$version")}catch(u){}return v};yad_GetSwfVer=function(){var B=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var y=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var x=navigator.plugins["Shockwave Flash"+y].description;var w=x.split(" ");var v=w[2].split(".");var A=v[0];var u=v[1];if(w[3]!=""){yad_tempArrayMinor=w[3].split("r")}else{yad_tempArrayMinor=w[4].split("r")}var z=yad_tempArrayMinor[1]>0?yad_tempArrayMinor[1]:0;var B=A+"."+u+"."+z}}else{if(b&&c&&!p){B=yad_ControlVersion()}}return B};yad_getVerNum=function(v){if(v==-1){return v}else{if(v!=0){if(b&&c&&!p){yad_tempArray=v.split(" ");yad_tempString=yad_tempArray[1];yad_versionArray=yad_tempString.split(",")}else{yad_versionArray=v.split(".")}var x=yad_versionArray[0];var u=yad_versionArray[1];var w=yad_versionArray[2];return x}else{return -1}}};var k=yad_GetSwfVer(),n=yad_getVerNum(k);this["yad_plugin_flash"+d]=false;if(n>=d){this["yad_plugin_flash"+d]=true}}var r="",j="clickTAG";for(i=0;i<e.length;i++){i==0?r+=j+"="+encodeURIComponent(e[i])+"&yad_time="+h+"&yad_page="+encodeURIComponent(f)+"&":r+=j+i+"="+encodeURIComponent(e[i])+"&yad_time="+h+"&yad_page="+encodeURIComponent(f)+"&"}this["yad_plugin_flash"+d]?document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+m+'" height="'+l+'" id="adbn_swf_'+g+'" ><param name="movie" value="'+q+'" /><param name="wmode" value="'+s+'" /><param name="loop" value="true" /><param name="quality" value="high" /><param name="allowScriptAccess" value="'+a+'" /><param name="flashvars" value="'+r+'" /><embed src="'+q+'" loop="true" wmode="'+s+'" quality="high" name="adbn_swf_'+g+'" width="'+m+'" height="'+l+'" flashvars="'+r+'" type="application/x-shockwave-flash" allowScriptAccess="'+a+'"></embed></object>'):document.write('<a href="'+t+'" target="_blank"><img src="'+o+'" width="'+m+'" height="'+l+'" border="0" /></a>')}}function yad_showAd_090213(){if(yad_pos.lastIndexOf("%")!=-1){yad_pos="yad"}if(yad_url&&yad_swf&&yad_aurl&&yad_aimg&&yad_pos&&yad_w&&yad_h&&yad_wmode&&yad_time&&yad_ver&&yad_allowscript){yad_ad_090213(yad_url,yad_swf,yad_aurl,yad_aimg,yad_pos,yad_w,yad_h,yad_wmode,yad_time,yad_ver,yad_allowscript)}}yad_showAd_090213();var yad_flash_lib_loaded_090213=true;

telnet l.yimg.com 80
GET /f/a/tw/js/flash_general_20090213.js HTTP/1.1
HOST: l.yimg.com
Accept-Encoding: gzip, deflate

response:
HTTP/1.1 200 OK
Date: Wed, 26 Oct 2011 15:27:01 GMT
Cache-Control: max-age=31536000
Expires: Thu, 25 Oct 2012 15:27:01 GMT
Last-Modified: Fri, 13 Feb 2009 06:26:17 GMT
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Type: application/x-javascript
Content-Encoding: gzip
Age: 594506
Content-Length: 1180
Connection: keep-alive
Server: YTS/1.20.4

?Vko?6?+
?1D;v^k?Ё?dE?u??`-QIT?W\W$%?;m??׹????屓1????c?fR?2đ?"??E?ZD.Y???(?n ?7d?I!|?0??C?CAB?B@?B(?%&[&??!`?(?$?}Ͻ???ݙ?1?c?z,?.?)،I?|?q?%I?TK;??g?Ϗ?w?:?u???<?t?d?wd3?/??!)5??&??;??mEyJ?اq??|H? d??7<??5A7k?
i?g?????w<?x`h???n̾}?1?j???g?^=?y{?5,p??DA`/g]???`???,?k7MB&?o?L???Y??mvǸ??fz??i?bWN?fG?
ӎ??؎r{????,???V?????Ȫ???k?]?V?????^U??[?&?{'?YS{'??a??k?ܬ:?????3޹t??b?Q????q?N??a?Z}??O????NȜ?ǟ????d?7dW???Cf?2A?????l??Mc??????ox??X6:?N?̲?g???Y&ħ??<%Z/?4W?G???N?]
?Q????nj8?2WE????nn'?w????m??w????ɇ????????yO??dn`plG?10?? S?P-?2?.?yZz?c?W{??1QE?` s??^?dSF??-Lzr??!*?{?????^?A??tD???ۍ???-9@??*?i??5R??RF??i???4ƵV5Ƽ??wC??dm?zQH%????{?䵓???S????p????D; Ǻ<F??`?r???8J&ӔD?K??|??Y?`??F????悞? ??U?m?ä??x???SW8??Y?f????湱jN??j๐_j???? Yoiq=?b?????Y??????g??5?*??ײ&߼??????a?c???D-#?[??:"?`վ??<d?yȉK[?n???o??L?

Connection closed by foreign host.


SSL:
openssl s_client -connect www.example.com:443 -state


GET /foo/javascripts/bar.js?0.0.26 HTTP/1.1
HOST:www.example.com
Accept-Encoding: gzip,deflate

curl -H "Accept-Encoding: gzip,deflate" https://www.htctouch.com/personalize/javascripts/htc-scenebuilder.js?0.0.26

沒有留言: