Fix wrongly handling proxy parameters given to curl

巧了,正好是我手贱把原来好好的 curl 参数顺序调乱了搞得脚本不指定代理就无法正常工作。
结果我意外因为这个发现脚本原本写的提供给 curl 的代理参数多了个空格,所以原来脚本是给了代理参数就不能正常工作的(

---

` curl '-x socks5h://1.1.1.1:9999' https://ipinfo.io `
> curl: (5) Unsupported proxy syntax in ' socks5h://1.1.1.1:9999'

注意这里报错消息里的空格。
pull/10/head
IceCodeNew 2020-06-12 12:56:53 +08:00
parent a0bb5d8eed
commit 56f37614f4
1 changed files with 6 additions and 6 deletions

View File

@ -230,7 +230,7 @@ get_version() {
# Get V2Ray release version number
TMP_FILE="$(mktemp)"
install_software curl
if ! curl -s "${PROXY}" -o "$TMP_FILE" https://api.github.com/repos/v2fly/v2ray-core/releases/latest; then
if ! curl ${PROXY} -s -o "$TMP_FILE" 'https://api.github.com/repos/v2fly/v2ray-core/releases/latest'; then
rm "$TMP_FILE"
echo 'error: Failed to get release list, please check your network.'
exit 1
@ -278,12 +278,12 @@ download_v2ray() {
mkdir "$TMP_DIRECTORY"
DOWNLOAD_LINK="https://github.com/v2fly/v2ray-core/releases/download/$RELEASE_VERSION/v2ray-linux-$MACHINE.zip"
echo "Downloading V2Ray archive: $DOWNLOAD_LINK"
if ! curl "${PROXY}" -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
if ! curl ${PROXY} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE" "$DOWNLOAD_LINK"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
echo "Downloading verification file for V2Ray archive: $DOWNLOAD_LINK.dgst"
if ! curl "${PROXY}" -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
if ! curl ${PROXY} -L -H 'Cache-Control: no-cache' -o "$ZIP_FILE.dgst" "$DOWNLOAD_LINK.dgst"; then
echo 'error: Download failed! Please check your network or try again.'
return 1
fi
@ -354,11 +354,11 @@ install_startup_service_file() {
if [[ ! -f '/etc/systemd/system/v2ray.service' ]]; then
mkdir "${TMP_DIRECTORY}systemd/system/"
install_software curl
if ! curl -s "${PROXY}" -o "${TMP_DIRECTORY}systemd/system/v2ray.service" https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray.service; then
if ! curl ${PROXY} -s -o "${TMP_DIRECTORY}systemd/system/v2ray.service" 'https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray.service'; then
echo 'error: Failed to start service file download! Please check your network or try again.'
exit 1
fi
if ! curl -s "${PROXY}" -o "${TMP_DIRECTORY}systemd/system/v2ray@.service" https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray@.service; then
if ! curl ${PROXY} -s -o "${TMP_DIRECTORY}systemd/system/v2ray@.service" 'https://raw.githubusercontent.workers.dev/v2fly/fhs-install-v2ray/master/systemd/system/v2ray@.service'; then
echo 'error: Failed to start service file download! Please check your network or try again.'
exit 1
fi