upload with PUT allows streaming

This commit is contained in:
2023-08-20 10:44:16 +03:00
parent 07aafd746d
commit 654891a61e
6 changed files with 110 additions and 60 deletions

View File

@@ -103,7 +103,7 @@ test -f "$IMAGE" || convert -size 640x480 xc:gray $IMAGE
function t00-rebuild-docker() {
CWD=$PWD
cd ..
docker-compose up --build -d --force-recreate
docker-compose up --build -d --force-recreate -t 0
cd "$CWD"
}
@@ -133,7 +133,7 @@ function t03-upload-small-file() {
}
function t04-upload-large-file() {
function t04-upload-large-file-POST() {
pv "$BIG" | \
curl -fL -w "\n" -F file="@-" -X POST \
-H "Name: $BIG" \
@@ -143,6 +143,16 @@ function t04-upload-large-file() {
"$FLASK_PUBLIC_URL"/upload
}
function t04-upload-large-file-GET() {
pv "$BIG" | \
curl -fL -w "\n" --upload-file - \
-H "Name: $BIG" \
-H "Max-Downloads: 4" \
-H "Expires-Days: 1" \
-H "Secret: $FLASK_ACCESS_TOKEN" \
"$FLASK_PUBLIC_URL"/upload
}
function t05-check-db-manually() {
sqlite3 ../data/flees.db "select * FROM files"
}
@@ -233,22 +243,25 @@ function t10-maintenance-post() {
}
function t11-get-mfl() {
curl -fL \
curl -fL \
-H "Secret: $FLASK_ACCESS_TOKEN" \
"$FLASK_PUBLIC_URL"/script/mfl > mfl
chmod +x mfl
chmod +x mfl
}
function t12-mfl-update() {
./mfl update
./mfl update
}
function t13-mfl-list() {
./mfl list
./mfl
./mfl list
./mfl
}
function t14-mfl-upload() {
./mfl w mfl
./mfl w -d 1 -m 1 mfl
./mfl w mfl
./mfl w -d 1 -m 1 mfl
cat mfl | ./mfl w mfl
./mfl w . "folder with spaces"
./mfl w "$SMALL"
}
@@ -279,19 +292,37 @@ _getchoice() {
}
next_task=0
while true; do
choice=$( _getchoice $next_task )
if [[ -z "$choice" ]]; then break; fi
_title "$choice"
set -x
"$choice"
set +x
_title ""
#~ next_task=$(( next_task + 1 ))
next_task=$( _getnext "$choice" )
if [[ -z "$1" ]]; then
done
next_task=0
while true; do
choice=$( _getchoice $next_task )
if [[ -z "$choice" ]]; then break; fi
_title "$choice"
set -x
"$choice"
set +x
_title ""
#~ next_task=$(( next_task + 1 ))
next_task=$( _getnext "$choice" )
done
else
# user passed commands from cmd line
if [[ "$1" = "all" ]]; then
args=$( _getlist )
else
args="$@"
fi
for choice in $args; do
_title "$choice"
set -x
"$choice"
set +x
_title ""
if [[ "$choice" = "t00-rebuild-docker" ]]; then sleep 3; fi
done
fi