From 02d4322cd4f67a078a29019d2c4ef591b281132c Mon Sep 17 00:00:00 2001 From: isaacs Date: Sat, 15 Feb 2014 12:01:09 -0800 Subject: Follow redirects on curl|sh installer script Closes #4673 --- scripts/install.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/install.sh b/scripts/install.sh index 7a0a45f5d..74840459e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -17,7 +17,16 @@ if [ "x$0" = "xsh" ]; then # on some systems, you can just do cat>npm-install.sh # which is a bit cuter. But on others, &1 is already closed, # so catting to another script file won't do anything. - curl -s https://npmjs.org/install.sh > npm-install-$$.sh + # Follow Location: headers, and fail on errors + curl -f -L -s https://www.npmjs.org/install.sh > npm-install-$$.sh + ret=$? + if [ $ret -eq 0 ]; then + (exit 0) + else + rm npm-install-$$.sh + echo "Failed to download script" >&2 + exit $ret + fi sh npm-install-$$.sh ret=$? rm npm-install-$$.sh -- cgit v1.2.3