lib/libnetwork.lib.in: curl.ftp_command: autodetected webdav support for mkdir, rename-file and delete
This commit is contained in:
parent
c27fa91d93
commit
5c7c9f997e
@ -789,6 +789,8 @@ action:,directory:,rename-from:,rename-to:,delete:,ftp-passive \
|
|||||||
|
|
||||||
[ "$ftp_passive" ] && options="$options $ftp_passive"
|
[ "$ftp_passive" ] && options="$options $ftp_passive"
|
||||||
|
|
||||||
|
[ "${1:0:4}" == "http" ] && http_mode=1
|
||||||
|
|
||||||
# NOTE: see RFC959 for the sintax of the 'quote' commands
|
# NOTE: see RFC959 for the sintax of the 'quote' commands
|
||||||
# curl --ftp-pasv --user user:password \
|
# curl --ftp-pasv --user user:password \
|
||||||
# -Q "MKD /devel/old/prova.dir" \
|
# -Q "MKD /devel/old/prova.dir" \
|
||||||
@ -798,21 +800,34 @@ action:,directory:,rename-from:,rename-to:,delete:,ftp-passive \
|
|||||||
mkdir)
|
mkdir)
|
||||||
[ "$directory" ] || notify.error $"\
|
[ "$directory" ] || notify.error $"\
|
||||||
(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--directory)"
|
(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--directory)"
|
||||||
notify.debug "\
|
|
||||||
curl $options --user \"***:***\" --quote \"MKD $directory\" $1"
|
|
||||||
|
|
||||||
curl $options --user "$user" --quote "MKD $directory" $1 &>/dev/null
|
if [ "$http_mode" == "1" ]; then
|
||||||
|
notify.debug "\
|
||||||
|
curl $options --user \"***:***\" -X MKCOL $1${directory}/"
|
||||||
|
curl $options --user "$user" -X MKCOL $1${directory}/ &>/dev/null
|
||||||
|
else
|
||||||
|
notify.debug "\
|
||||||
|
curl $options --user \"***:***\" --quote \"MKD $directory\" $1"
|
||||||
|
curl $options --user "$user" --quote "MKD $directory" $1 &>/dev/null
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
rename-file)
|
rename-file)
|
||||||
[ "$fromfile" ] || notify.error $"\
|
[ "$fromfile" ] || notify.error $"\
|
||||||
(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--rename-from)"
|
(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--rename-from)"
|
||||||
[ "$tofile" ] || notify.error $"\
|
[ "$tofile" ] || notify.error $"\
|
||||||
(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--rename-to)"
|
(bug)"" -- $FUNCNAME: "$"missing mandatory arg"" (--rename-to)"
|
||||||
notify.debug "curl $options --user \"***:***\"\
|
|
||||||
--quote \"RNFR $fromfile\" --quote \"RNTO $tofile\" $1"
|
|
||||||
|
|
||||||
curl $options --user "$user" \
|
if [ "$http_mode" == "1" ]; then
|
||||||
--quote "RNFR $fromfile" --quote "RNTO $tofile" $1 &>/dev/null
|
notify.debug "curl $options --user \"***:***\" -X MOVE\
|
||||||
|
--header \"Destination:$1$tofile\" $1$fromfile"
|
||||||
|
curl $options --user "$user" -X MOVE \
|
||||||
|
--header "Destination:$1$tofile" $1$fromfile &>/dev/null
|
||||||
|
else
|
||||||
|
notify.debug "curl $options --user \"***:***\"\
|
||||||
|
--quote \"RNFR $fromfile\" --quote \"RNTO $tofile\" $1"
|
||||||
|
curl $options --user "$user" \
|
||||||
|
--quote "RNFR $fromfile" --quote "RNTO $tofile" $1 &>/dev/null
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
delete)
|
delete)
|
||||||
[ "$deletefile" ] || notify.error $"\
|
[ "$deletefile" ] || notify.error $"\
|
||||||
@ -827,9 +842,15 @@ curl $options --user \"***:***\" --quote \"MKD $directory\" $1"
|
|||||||
# curl -v --ftp-pasv --user "$user" \
|
# curl -v --ftp-pasv --user "$user" \
|
||||||
# --quote "DELE SRPMS.base/filename-0.0.1-1distro.src.rpm" \
|
# --quote "DELE SRPMS.base/filename-0.0.1-1distro.src.rpm" \
|
||||||
# ftp://ftpaccounts.openmamba.org
|
# ftp://ftpaccounts.openmamba.org
|
||||||
notify.debug "\
|
if [ "$http_mode" == "1" ]; then
|
||||||
|
notify.debug "\
|
||||||
|
curl $options --user \"***:***\" -X DELETE $1$deletefile"
|
||||||
|
curl $options --user "$user" -X DELETE $1$deletefile &>/dev/null
|
||||||
|
else
|
||||||
|
notify.debug "\
|
||||||
curl $options --user \"***:***\" --quote \"DELE $deletefile\" $1"
|
curl $options --user \"***:***\" --quote \"DELE $deletefile\" $1"
|
||||||
curl $options --user "$user" --quote "DELE $deletefile" $1 &>/dev/null
|
curl $options --user "$user" --quote "DELE $deletefile" $1 &>/dev/null
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*) notify.error $"\
|
*) notify.error $"\
|
||||||
(bug)"" -- $FUNCNAME: "$"unknown action"": ($action)"
|
(bug)"" -- $FUNCNAME: "$"unknown action"": ($action)"
|
||||||
|
Loading…
Reference in New Issue
Block a user