mirror of https://github.com/perkeep/perkeep.git
client: fix blobserver path in curl and python clients
Change-Id: Ie7a204ee64a9373c696e447ccf93a790584676d6
This commit is contained in:
parent
8560c6d513
commit
778a607c67
|
@ -3,7 +3,7 @@
|
|||
# Example client accesses to blob server using curl.
|
||||
|
||||
# Configuration variables here:
|
||||
BSHOST=localhost:8080
|
||||
BSHOST=localhost:3179/bs
|
||||
BSUSER=user
|
||||
BSPASS=foo
|
||||
|
||||
|
|
|
@ -17,5 +17,5 @@ chomp $sha1;
|
|||
$sha1 =~ s/\s.+//;
|
||||
|
||||
system("curl", "-u", "foo:foo", "-F", "sha1-$sha1=\@$file",
|
||||
"http://127.0.0.1:3179/camli/upload") and die "upload failed.";
|
||||
print "Uploaded http://127.0.0.1:3179/camli/sha1-$sha1\n";
|
||||
"http://127.0.0.1:3179/bs/camli/upload") and die "upload failed.";
|
||||
print "Uploaded http://127.0.0.1:3179/bs/camli/sha1-$sha1\n";
|
||||
|
|
|
@ -137,7 +137,7 @@ Commands:
|
|||
default='',
|
||||
help='username:pasword for HTTP basic authentication')
|
||||
parser.add_option('-s', '--server', dest='server',
|
||||
default='localhost:8080',
|
||||
default='localhost:3179',
|
||||
help='hostname:port to connect to')
|
||||
parser.add_option('-d', '--debug', dest='debug',
|
||||
action='store_true',
|
||||
|
@ -159,7 +159,7 @@ Commands:
|
|||
if opts.debug:
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
|
||||
op = camli.op.CamliOp(opts.server, auth=opts.auth)
|
||||
op = camli.op.CamliOp(opts.server, auth=opts.auth, basepath="/bs")
|
||||
command = args[0].lower()
|
||||
|
||||
if command == 'putdir':
|
||||
|
|
|
@ -83,7 +83,7 @@ class CamliOp(object):
|
|||
buffer_size=BUFFER_SIZE,
|
||||
create_connection=httplib.HTTPConnection,
|
||||
auth=None,
|
||||
basepath=False):
|
||||
basepath=""):
|
||||
"""Initializer.
|
||||
|
||||
Args:
|
||||
|
@ -100,6 +100,7 @@ class CamliOp(object):
|
|||
self._create_connection = create_connection
|
||||
self._connection = None
|
||||
self._authorization = ''
|
||||
self.basepath = ""
|
||||
if auth:
|
||||
if len(auth.split(':')) != 2:
|
||||
# Default to dummy username; current server doesn't care
|
||||
|
@ -348,7 +349,11 @@ class CamliOp(object):
|
|||
|
||||
for blobref in blobref_list:
|
||||
logging.debug('Getting blobref=%s', blobref)
|
||||
self.connection.request('GET', '/camli/' + blobref)
|
||||
if self.basepath:
|
||||
fullpath = self.basepath + '/camli/'
|
||||
else:
|
||||
fullpath = '/camli/'
|
||||
self.connection.request('GET', fullpath + blobref)
|
||||
response = self.connection.getresponse()
|
||||
if response.status == 404:
|
||||
logging.debug('Server does not have blobref=%s', blobref)
|
||||
|
|
Loading…
Reference in New Issue