put fails, but it looks like full data is still available.

The second PUT fails, the HEAD also claims to only have 3 bytes,
that would be inline with the fail. However the final get is able
to return the full 6 bytes. 3 of which are stored by the 2nd PUT that
was reported to fail.
This commit is contained in:
Kevin van Zonneveld 2013-03-20 16:51:06 +01:00
parent 06c230a0c2
commit e68f74faa0
1 changed files with 42 additions and 15 deletions

View File

@ -9,36 +9,63 @@
SERVICE="localhost:1080" SERVICE="localhost:1080"
# Environment # Environment
set -ex set -e
__FILE__="$(test -L "${0}" && readlink "${0}" || echo "${0}")" __FILE__="$(test -L "${0}" && readlink "${0}" || echo "${0}")"
__DIR__="$(cd "$(dirname "${__FILE__}")"; echo $(pwd);)" __DIR__="$(cd "$(dirname "${__FILE__}")"; echo $(pwd);)"
# POST requests the upload location # POST requests the upload location
echo "POST '${SERVICE}'" echo -ne "POST '${SERVICE}' \t\t\t\t\t\t\t"
location=$(curl -s \ location=$(curl -s \
--include \ --include \
--request POST \ --request POST \
--header 'Content-Range: bytes */26' \ --header 'Content-Range: bytes */26' \
${SERVICE}/files | awk -F': ' '/^Location/ {print $2}') ${SERVICE}/files |awk -F': ' '/^Location/ {print $2}' |tr -d '\r')
# `tr -d '\r'` is required or location will have one in it ---^
# needs a `tr -d '\r'` or location will be messed up ----^ echo "<-- Location: ${location}"
# causing tusd connection to hang after it throws a
# 500 - Internal Server Error
# PUT some data # PUT some data
echo "PUT '${SERVICE}${location}'" echo -ne "PUT '${SERVICE}${location}' \t\t"
curl -s \ status=$(curl -s \
--include \ --include \
--request PUT \ --request PUT \
--header 'Content-Length: 3' \ --header 'Content-Length: 3' \
--header 'Content-Range: bytes 0-2/26' \ --header 'Content-Range: bytes 0-2/26' \
--data 'abc' \ --data 'abc' \
${SERVICE}${location} ${SERVICE}${location} |head -n1 |tr -d '\r')
echo "<-- ${status}"
# check that data with HEAD # check that data with HEAD
echo "HEAD '${SERVICE}${location}'" echo -ne "HEAD '${SERVICE}${location}' \t\t"
curl -s \ has_range=$(curl -s -I -X HEAD ${SERVICE}${location} |awk -F': ' '/^Range/ {print $2}' |tr -d '\r')
--include \ echo "<-- Range: ${has_range}"
--request HEAD \
${SERVICE}${location}
# get that data with GET
echo -ne "GET '${SERVICE}${location}' \t\t"
has_content=$(curl -s ${SERVICE}${location})
echo "<-- ${has_content}"
# PUT some data
echo -ne "PUT '${SERVICE}${location}' \t\t"
status=$(curl -s \
--include \
--request PUT \
--header 'Content-Length: 3' \
--header 'Content-Range: bytes 22-25/26' \
--data 'xyz' \
${SERVICE}${location} |head -n1 |tr -d '\r')
echo "<-- ${status}"
# check that data with HEAD
echo -ne "HEAD '${SERVICE}${location}' \t\t"
has_range=$(curl -s -I -X HEAD ${SERVICE}${location} |awk -F': ' '/^Range/ {print $2}' |tr -d '\r')
echo "<-- Range: ${has_range}"
# get that data with GET
echo -ne "GET '${SERVICE}${location}' \t\t"
has_content=$(curl -s ${SERVICE}${location})
echo "<-- ${has_content}"