Subversion Repositories DevTools

Rev

Rev 5810 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5810 Rev 5811
Line 189... Line 189...
189
#
189
#
190
# Calculate the HEAD signature.
190
# Calculate the HEAD signature.
191
#   Note the need for a triple \n
191
#   Note the need for a triple \n
192
#   Is that because there is no contentType ?
192
#   Is that because there is no contentType ?
193
#
193
#
-
 
194
dateValue=$(date -R)
194
stringToSign="HEAD\n\n\n${dateValue}\n${resource}"
195
stringToSign="HEAD\n\n\n${dateValue}\n${resource}"
195
signature=$(
196
signature=$(
196
    echo -en "${stringToSign}" |
197
    echo -en "${stringToSign}" |
197
    openssl sha1 -hmac "${aws_secret_access_key}" -binary |
198
    openssl sha1 -hmac "${aws_secret_access_key}" -binary |
198
    base64
199
    base64
Line 201... Line 202...
201
#set -x
202
#set -x
202
fileTest=0
203
fileTest=0
203
for ii in $( seq 1 10 ); do 
204
for ii in $( seq 1 10 ); do 
204
    [ $verbose -gt 0 ] && echo "Testing file presence ($ii): ${file}"
205
    [ $verbose -gt 0 ] && echo "Testing file presence ($ii): ${file}"
205
    results=$(curl -I -X HEAD \
206
    results=$(curl -I -X HEAD \
206
            -s \
207
            -s --verbose \
207
             --insecure \
208
             --insecure \
208
            -H "Host: ${bucket}.s3.amazonaws.com" \
209
            -H "Host: ${bucket}.s3.amazonaws.com" \
209
            -H "Date: ${dateValue}" \
210
            -H "Date: ${dateValue}" \
210
            -H "Authorization: AWS ${aws_access_key_id}:${signature}" \
211
            -H "Authorization: AWS ${aws_access_key_id}:${signature}" \
211
            "https://${bucket}.s3.amazonaws.com/${file}" \
212
            "https://${bucket}.s3.amazonaws.com/${file}" \
212
            )
213
            )
-
 
214
    [ $verbose -gt 0 ] && echo "Testing file results: ${results}"
213
    if [[ "$results" =~ "HTTP/1.1 200 OK" ]]; then
215
    if [[ "$results" =~ "HTTP/1.1 200 OK" ]]; then
214
        fileTest=1
216
        fileTest=1
215
        break
217
        break
216
    fi
218
    fi
217
    echo "Test Fail: ${file}. Attempt: ${ii}"
219
    echo "Test Fail: ${file}. Attempt: ${ii}"