Created
September 14, 2017 21:18
-
-
Save jwhitlock/ba528e8f6748992734bc31e251fae3e2 to your computer and use it in GitHub Desktop.
Use curl to analyze headers of files in SCL3 and AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
function curl_it { | |
path=$1 | |
domain1=$2 | |
domain2=$3 | |
echo | |
tmp1=`mktemp` | |
tmpfiltered=`mktemp` | |
tmp1_filtered=`mktemp` | |
tmp2=`mktemp` | |
tmp2_filtered=`mktemp` | |
echo "***** Fetching ${path} from ${domain1} *****" | |
curl -v --silent "https://${domain1}${path}" > /dev/null 2> "$tmp1" | |
cat $tmp1 | |
grep "^<" "$tmp1" | cut -c3- | grep -v "^Server:" > $tmpfiltered | |
head -n1 $tmpfiltered > $tmp1_filtered | |
cat $tmpfiltered | grep -v "^HTTP/1" | sort >> $tmp1_filtered | |
cat $tmp1_filtered | |
echo "***** Fetching ${path} from ${domain2} *****" | |
curl -v -k --silent "https://${domain2}${path}" > /dev/null 2> "$tmp2" | |
cat $tmp2 | |
grep "^<" "$tmp2" | cut -c3- | grep -v "^Server:" > $tmpfiltered | |
head -n1 $tmpfiltered > $tmp2_filtered | |
cat $tmpfiltered | grep -v "^HTTP/1" | sort >> $tmp2_filtered | |
cat $tmp2_filtered | |
echo "**** Diff of ${path} from ${domain1} to ${domain2} *****" | |
diff $tmp1_filtered $tmp2_filtered | |
rm $tmp1 $tmp2 $tmp1_filtered $tmp2_filtered $tmpfiltered | |
} | |
MAIN_PROD=developer.mozilla.org | |
MM_PROD=mdn-mm.moz.works | |
function curl_main { | |
path="$1" | |
curl_it "$1" $MAIN_PROD $MM_PROD | |
} | |
MAIN_DEMO=mdn.mozillademos.org | |
MM_DEMO=mdn-mm-demos.moz.works | |
function curl_demo { | |
path="$1" | |
curl_it "$1" $MAIN_DEMO $MM_DEMO | |
} | |
curl_main /contribute.json # application/json | |
exit 0 | |
curl_demo /files/2536/Jake-duffin-1.doc # application/msword | |
curl_demo /files/3451/Bugs.cdf # application/msword | |
curl_main /diagrams/workflow/images/socorro.png # image/png | |
curl_main /diagrams/workflow/mozilla_workflow.gv.txt # text/plain | |
curl_main /presentations/AllAboutCommunity.pdf # application/pdf | |
curl_main /presentations/eich-ajax-experience-2007/photos.svg # image/svg+xml | |
curl_main /presentations/eich-ajax-experience-2007/ui/default/framing.css # text/css | |
curl_main /presentations/javascript2/bigo.html # text/html | |
curl_main /presentations/javascript2/images/designingfornext10years.jpg # image/jpeg | |
curl_main /presentations/oscon2005/Ben-EuroOSCON2005.ppt # application/vnd.ms-powerpoint | |
curl_main /presentations/sxsw2007/the_open_web/images/Frederick-Furnivall.gif # image/gif | |
curl_main /presentations/xtech2005/e4x/ui/.DS_Store # application/octet-stream | |
curl_main /presentations/xtech2006/xulrunner/XTech%20Slides%20New.odp # application/vnd.oasis.opendocument.presentation | |
curl_main /samples/cssref/transitions/sample1/transitiondemo1.ogv # video/ogg | |
curl_main /samples/domref/cup.ogg # audio/ogg | |
curl_main /samples/svg/swarm-of-motes.xhtml # application/xhtml+xml | |
curl_main /samples/xultu/examples/ex_5_2_3.xul.txt # text/plain (but application/xhtml+xml content) | |
curl_main /samples/xultu/examples/findfile/findfile.xpi # application/x-xpinstall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment