Commit 157fb563 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add -4/-6 support (force use IPv4/6)

parent d6866062
...@@ -212,6 +212,7 @@ LATEST='' ...@@ -212,6 +212,7 @@ LATEST=''
SECONDLATEST='' SECONDLATEST=''
CHECKMIRRORS='' CHECKMIRRORS=''
TARGETFILE='' TARGETFILE=''
FORCEIPV=''
set_quiet() set_quiet()
{ {
...@@ -231,6 +232,8 @@ Options: ...@@ -231,6 +232,8 @@ Options:
-q - quiet mode -q - quiet mode
-k|--no-check-certificate - skip SSL certificate chain support -k|--no-check-certificate - skip SSL certificate chain support
-U|-A|--user-agent - send browser like UserAgent -U|-A|--user-agent - send browser like UserAgent
-4|--ipv4|--inet4-only - use only IPV4
-6|--ipv6|--inet6-only - use only IPV6
-O-|-O - - output downloaded file to stdout -O-|-O - - output downloaded file to stdout
-O file - download to this file -O file - download to this file
--latest - print only latest version of a file --latest - print only latest version of a file
...@@ -279,6 +282,12 @@ while [ -n "$1" ] ; do ...@@ -279,6 +282,12 @@ while [ -n "$1" ] ; do
WGETUSERAGENT="-U '$user_agent'" WGETUSERAGENT="-U '$user_agent'"
CURLUSERAGENT="-A '$user_agent'" CURLUSERAGENT="-A '$user_agent'"
;; ;;
-4|--ipv4|--inet4-only)
FORCEIPV="-4"
;;
-6|--ipv6|--inet6-only)
FORCEIPV="-6"
;;
--list|--list-only) --list|--list-only)
LISTONLY="$1" LISTONLY="$1"
set_quiet set_quiet
...@@ -347,9 +356,9 @@ elif [ -n "$WGET" ] ; then ...@@ -347,9 +356,9 @@ elif [ -n "$WGET" ] ; then
__wget() __wget()
{ {
if [ -n "$WGETUSERAGENT" ] ; then if [ -n "$WGETUSERAGENT" ] ; then
docmd $WGET $WGETQ $WGETNOSSLCHECK "$WGETUSERAGENT" "$@" docmd $WGET $FORCEIPV $WGETQ $WGETNOSSLCHECK "$WGETUSERAGENT" "$@"
else else
docmd $WGET $WGETQ $WGETNOSSLCHECK "$@" docmd $WGET $FORCEIPV $WGETQ $WGETNOSSLCHECK "$@"
fi fi
} }
...@@ -389,9 +398,9 @@ CURL="$(print_command_path curl)" ...@@ -389,9 +398,9 @@ CURL="$(print_command_path curl)"
__curl() __curl()
{ {
if [ -n "$CURLUSERAGENT" ] ; then if [ -n "$CURLUSERAGENT" ] ; then
docmd $CURL --fail -L $CURLQ "$CURLUSERAGENT" $CURLNOSSLCHECK "$@" docmd $CURL $FORCEIPV --fail -L $CURLQ "$CURLUSERAGENT" $CURLNOSSLCHECK "$@"
else else
docmd $CURL --fail -L $CURLQ $CURLNOSSLCHECK "$@" docmd $CURL $FORCEIPV --fail -L $CURLQ $CURLNOSSLCHECK "$@"
fi fi
} }
# put remote content to stdout # put remote content to stdout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment