2010-06-21 01:32:42 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Example client accesses to blob server using curl.
|
|
|
|
|
2010-11-05 05:10:20 +00:00
|
|
|
# Configuration variables here:
|
2010-11-05 05:01:01 +00:00
|
|
|
BSHOST=localhost:8080
|
2010-11-05 05:10:20 +00:00
|
|
|
BSUSER=user
|
2010-11-05 05:01:01 +00:00
|
|
|
BSPASS=foo
|
2010-06-21 01:32:42 +00:00
|
|
|
|
2010-11-05 05:10:20 +00:00
|
|
|
# Shorter name for curl auth param:
|
|
|
|
AUTH=$BSUSER:$BSPASS
|
|
|
|
|
2010-08-03 04:05:54 +00:00
|
|
|
# Preupload -- 200 response
|
2010-11-05 05:10:20 +00:00
|
|
|
curl -u $AUTH -d camliversion=1 http://$BSHOST/camli/preupload
|
2010-08-03 04:05:54 +00:00
|
|
|
|
|
|
|
# Upload -- 200 response
|
2010-11-05 05:10:20 +00:00
|
|
|
curl -u $AUTH -v -L \
|
2010-08-03 04:05:54 +00:00
|
|
|
-F sha1-126249fd8c18cbb5312a5705746a2af87fba9538=@./test_data.txt \
|
|
|
|
#<the url returned by preupload>
|
2010-06-21 01:32:42 +00:00
|
|
|
|
|
|
|
# Put with bad blob_ref parameter -- 400 response
|
|
|
|
curl -v -L \
|
2010-08-03 04:05:54 +00:00
|
|
|
-F sha1-22a7fdd575f4c3e7caa3a55cc83db8b8a6714f0f=@./test_data.txt \
|
|
|
|
#<the url returned by preupload>
|
2010-06-21 01:32:42 +00:00
|
|
|
|
|
|
|
# Get present -- the blob
|
2010-11-05 05:10:20 +00:00
|
|
|
curl -u $AUTH -v http://$BSHOST/camli/sha1-126249fd8c18cbb5312a5705746a2af87fba9538
|
2010-06-21 01:32:42 +00:00
|
|
|
|
|
|
|
# Get missing -- 404
|
2010-11-05 05:10:20 +00:00
|
|
|
curl -u $AUTH -v http://$BSHOST/camli/sha1-22a7fdd575f4c3e7caa3a55cc83db8b8a6714f0f
|
2010-06-21 01:32:42 +00:00
|
|
|
|
2010-08-03 04:05:54 +00:00
|
|
|
# Check present -- 200 with only headers
|
2010-11-05 05:10:20 +00:00
|
|
|
curl -u $AUTH -I http://$BSHOST/camli/sha1-126249fd8c18cbb5312a5705746a2af87fba9538
|
2010-06-21 01:32:42 +00:00
|
|
|
|
|
|
|
# Check missing -- 404 with empty list response
|
2010-11-05 05:01:01 +00:00
|
|
|
curl -I http://$BSHOST/camli/sha1-22a7fdd575f4c3e7caa3a55cc83db8b8a6714f0f
|
2010-06-21 01:32:42 +00:00
|
|
|
|
|
|
|
# List -- 200 with list of blobs (just one)
|
2010-11-05 05:10:20 +00:00
|
|
|
curl -v -u $AUTH http://$BSHOST/camli/enumerate-blobs?limit=1
|
2010-06-21 01:32:42 +00:00
|
|
|
|
|
|
|
# List offset -- 200 with list of no blobs
|
2010-11-05 05:10:20 +00:00
|
|
|
curl -v -u $AUTH http://$BSHOST/camli/enumerate-blobs?after=sha1-126249fd8c18cbb5312a5705746a2af87fba9538
|