Commit 5777679e authored by Vitaly Lipatov's avatar Vitaly Lipatov

eget: use Content-disposition for downloaded filename

parent 383cb1a4
...@@ -105,6 +105,8 @@ check_tty ...@@ -105,6 +105,8 @@ check_tty
WGETQ='' #-q WGETQ='' #-q
CURLQ='' #-s CURLQ='' #-s
WGETOPTIONS='--content-disposition'
CURLOPTIONS='--remote-name --remote-header-name'
set_quiet() set_quiet()
{ {
...@@ -125,15 +127,19 @@ if [ -n "$WGET" ] ; then ...@@ -125,15 +127,19 @@ if [ -n "$WGET" ] ; then
# put remote content to stdout # put remote content to stdout
scat() scat()
{ {
$WGET $WGETQ -O- "$1" docmd $WGET $WGETQ -O- "$1"
} }
# download to default name of to $2 # download to default name of to $2
sget() sget()
{ {
if [ -n "$2" ] ; then if [ -n "$2" ] ; then
$WGET $WGETQ -O "$2" "$1" docmd $WGET $WGETQ $WGETOPTIONS -O "$2" "$1"
else else
$WGET $WGETQ "$1" # TODO: поддержка rsync для известных хостов?
# Не качать, если одинаковый размер и дата
# -nc
# TODO: overwrite always
docmd $WGET $WGETQ $WGETOPTIONS "$1"
fi fi
} }
...@@ -149,9 +155,9 @@ scat() ...@@ -149,9 +155,9 @@ scat()
sget() sget()
{ {
if [ -n "$2" ] ; then if [ -n "$2" ] ; then
$CURL -L $CURLQ --output "$2" "$1" docmd $CURL -L $CURLQ $CURLOPTIONS --output "$2" "$1"
else else
$CURL -L $CURLQ -O "$1" docmd $CURL -L $CURLQ $CURLOPTIONS -O "$1"
fi fi
} }
fi fi
......
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