Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add HTTP(S)_PROXY and http(s)_proxy exports #45

Merged
merged 1 commit into from
Mar 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions o.rc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,35 @@ orc_loadURL () {
# Loads from an URL via curl, wget or perl.
# Argument: The URL to download, https is supported.
# Output to stdout: The content of the URL document.
# Global: http(s)_proxy variables will be used.
if [ $# -ne 1 ]; then
echo 'Error: argument must be one URL to load'
return 1
fi
# A proxy could be set via environment variables to the tools.
# But some tools in some versions needs lower case and some
# needs upper case variable names. To increase portability
# both cases will be exported.
export http_proxy
export HTTP_PROXY
if [ -n "$http_proxy" ]; then
if [ -n "$HTTP_PROXY" ] && [ "$HTTP_PROXY" != "$http_proxy" ]; then
echo 'Warning, ignore HTTP_PROXY value and use http_proxy value.'
fi
HTTP_PROXY=$http_proxy
elif [ -n "$HTTP_PROXY" ]; then
http_proxy=$HTTP_PROXY
fi
export https_proxy
export HTTPS_PROXY
if [ -n "$https_proxy" ]; then
if [ -n "$HTTPS_PROXY" ] && [ "$HTTPS_PROXY" != "$https_proxy" ]; then
echo 'Warning, ignore HTTPS_PROXY value and use https_proxy value.'
fi
HTTPS_PROXY=$https_proxy
elif [ -n "$HTTPS_PROXY" ]; then
https_proxy=$HTTPS_PROXY
fi
if orc_existsProg curl; then
curl --silent --location --insecure -- "$1"
elif orc_existsProg wget; then
Expand Down