Commit f831a883 authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: add --compressed (send Accept-Encoding and decode result)

parent a3e27ce2
...@@ -289,6 +289,8 @@ WGETNOSSLCHECK='' ...@@ -289,6 +289,8 @@ WGETNOSSLCHECK=''
CURLNOSSLCHECK='' CURLNOSSLCHECK=''
WGETUSERAGENT='' WGETUSERAGENT=''
CURLUSERAGENT='' CURLUSERAGENT=''
WGETCOMPRESSED=''
CURLCOMPRESSED=''
WGETQ='' #-q WGETQ='' #-q
CURLQ='' #-s CURLQ='' #-s
# TODO: aria2c # TODO: aria2c
...@@ -330,6 +332,7 @@ Options: ...@@ -330,6 +332,7 @@ Options:
--verbose - verbose mode --verbose - verbose 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
--compressed - request a compressed response and automatically decompress the content
-4|--ipv4|--inet4-only - use only IPV4 -4|--ipv4|--inet4-only - use only IPV4
-6|--ipv6|--inet6-only - use only IPV6 -6|--ipv6|--inet6-only - use only IPV6
-O-|-O - - output downloaded file to stdout -O-|-O - - output downloaded file to stdout
...@@ -393,6 +396,10 @@ while [ -n "$1" ] ; do ...@@ -393,6 +396,10 @@ while [ -n "$1" ] ; do
WGETUSERAGENT="-U '$user_agent'" WGETUSERAGENT="-U '$user_agent'"
CURLUSERAGENT="-A '$user_agent'" CURLUSERAGENT="-A '$user_agent'"
;; ;;
--compressed)
CURLCOMPRESSED='--compressed'
WGETCOMPRESSED='--compression=auto'
;;
-4|--ipv4|--inet4-only) -4|--ipv4|--inet4-only)
FORCEIPV="-4" FORCEIPV="-4"
;; ;;
...@@ -853,9 +860,9 @@ elif [ "$EGET_BACKEND" = "wget" ] ; then ...@@ -853,9 +860,9 @@ elif [ "$EGET_BACKEND" = "wget" ] ; then
__wget() __wget()
{ {
if [ -n "$WGETUSERAGENT" ] ; then if [ -n "$WGETUSERAGENT" ] ; then
docmd $WGET $FORCEIPV $WGETQ $WGETNOSSLCHECK "$WGETUSERAGENT" "$@" docmd $WGET $FORCEIPV $WGETQ $WGETCOMPRESSED $WGETNOSSLCHECK "$WGETUSERAGENT" "$@"
else else
docmd $WGET $FORCEIPV $WGETQ $WGETNOSSLCHECK "$@" docmd $WGET $FORCEIPV $WGETQ $WGETCOMPRESSED $WGETNOSSLCHECK "$@"
fi fi
} }
...@@ -902,9 +909,9 @@ elif [ "$EGET_BACKEND" = "curl" ] ; then ...@@ -902,9 +909,9 @@ elif [ "$EGET_BACKEND" = "curl" ] ; then
__curl() __curl()
{ {
if [ -n "$CURLUSERAGENT" ] ; then if [ -n "$CURLUSERAGENT" ] ; then
docmd $CURL $FORCEIPV --fail -L $CURLQ "$CURLUSERAGENT" $CURLNOSSLCHECK "$@" docmd $CURL $FORCEIPV --fail -L $CURLQ $CURLCOMPRESSED "$CURLUSERAGENT" $CURLNOSSLCHECK "$@"
else else
docmd $CURL $FORCEIPV --fail -L $CURLQ $CURLNOSSLCHECK "$@" docmd $CURL $FORCEIPV --fail -L $CURLQ $CURLCOMPRESSED $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