set default cred loading for newer curl now where possible as it's more reliable as doesn't need parsing

pull/2/head
Hari Sekhon 4 years ago
parent 24b765d4b4
commit c680c6d35a

@ -63,7 +63,9 @@ if [ -z "${KRB5:-${KERBEROS:-}}" ]; then
# works on Mac but not on Linux, so going back to parsing the hostname and dynamic loading
# curl 7.64.1 (x86_64-apple-darwin19.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.39.2
# curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
#netrc_contents="default login $USERNAME password $PASSWORD"
if is_curl_min_version 7.64; then
netrc_contents="default login $USERNAME password $PASSWORD"
fi
# ==============================================
# option 2
@ -83,13 +85,15 @@ if [ -z "${KRB5:-${KERBEROS:-}}" ]; then
# Instead of generating this for all known hosts above just do it for the host extracted from the args url now
if ! [[ "$*" =~ :// ]]; then
usage "http(s):// not specified in URL"
fi
if [ -z "$netrc_contents" ]; then
if ! [[ "$*" =~ :// ]]; then
usage "http(s):// not specified in URL"
fi
host="$(grep -om 1 '://[^:\/[:space:]]\+' <<< "$*" | sed 's,://,,')"
host="$(grep -om 1 '://[^:\/[:space:]]\+' <<< "$*" | sed 's,://,,')"
netrc_contents="machine $host login $USERNAME password $PASSWORD"
netrc_contents="machine $host login $USERNAME password $PASSWORD"
fi
# ==============================================

Loading…
Cancel
Save