Merged from trunk
This commit is contained in:
commit
f4fa3d626c
@ -228,7 +228,7 @@ class AccountController(object):
|
||||
(name, object_count, bytes_used))
|
||||
account_list = '[' + ','.join(json_out) + ']'
|
||||
elif out_content_type.endswith('/xml'):
|
||||
output_list = ['<?xml version="1.0" encoding="UTF-8"?>',
|
||||
output_list = ['<?xml version="1.1" encoding="UTF-8"?>',
|
||||
'<account name="%s">' % account]
|
||||
for (name, object_count, bytes_used, is_subdir) in account_list:
|
||||
name = saxutils.escape(name, XML_EXTRA_ENTITIES)
|
||||
|
@ -342,7 +342,7 @@ class ContainerController(object):
|
||||
'<last_modified>%s</last_modified></object>' % \
|
||||
(name, etag, size, content_type, created_at))
|
||||
container_list = ''.join([
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\n',
|
||||
'<?xml version="1.1" encoding="UTF-8"?>\n',
|
||||
'<container name=%s>' %
|
||||
saxutils.quoteattr(container, XML_EXTRA_ENTITIES),
|
||||
''.join(xml_output), '</container>'])
|
||||
|
@ -611,9 +611,10 @@ class ObjectController(object):
|
||||
if_modified_since:
|
||||
file.close()
|
||||
return HTTPNotModified(request=request)
|
||||
response = Response(content_type=file.metadata.get('Content-Type',
|
||||
'application/octet-stream'), app_iter=file,
|
||||
response = Response(app_iter=file,
|
||||
request=request, conditional_response=True)
|
||||
response.headers['Content-Type'] = file.metadata.get('Content-Type',
|
||||
'application/octet-stream')
|
||||
for key, value in file.metadata.iteritems():
|
||||
if key.lower().startswith('x-object-meta-') or \
|
||||
key.lower() in self.allowed_headers:
|
||||
@ -651,8 +652,9 @@ class ObjectController(object):
|
||||
except (DiskFileError, DiskFileNotExist):
|
||||
file.quarantine()
|
||||
return HTTPNotFound(request=request)
|
||||
response = Response(content_type=file.metadata['Content-Type'],
|
||||
request=request, conditional_response=True)
|
||||
response = Response(request=request, conditional_response=True)
|
||||
response.headers['Content-Type'] = file.metadata.get('Content-Type',
|
||||
'application/octet-stream')
|
||||
for key, value in file.metadata.iteritems():
|
||||
if key.lower().startswith('x-object-meta-') or \
|
||||
key.lower() in self.allowed_headers:
|
||||
|
@ -901,7 +901,13 @@ class ObjectController(Controller):
|
||||
req.headers['X-Copy-From'] = '/%s/%s' % (self.container_name,
|
||||
self.object_name)
|
||||
req.headers['X-Fresh-Metadata'] = 'true'
|
||||
return self.PUT(req)
|
||||
resp = self.PUT(req)
|
||||
# Older editions returned 202 Accepted on object POSTs, so we'll
|
||||
# convert any 201 Created responses to that for compatibility with
|
||||
# picky clients.
|
||||
if resp.status_int != 201:
|
||||
return resp
|
||||
return HTTPAccepted(request=req)
|
||||
else:
|
||||
error_response = check_metadata(req, 'object')
|
||||
if error_response:
|
||||
|
@ -608,7 +608,7 @@ class TestContainerController(unittest.TestCase):
|
||||
'HTTP_X_SIZE': 0})
|
||||
resp = self.controller.PUT(req)
|
||||
self.assertEquals(resp.status_int, 201)
|
||||
xml_body = '<?xml version="1.0" encoding="UTF-8"?>\n' \
|
||||
xml_body = '<?xml version="1.1" encoding="UTF-8"?>\n' \
|
||||
'<container name="xmlc">' \
|
||||
'<object><name>0</name><hash>x</hash><bytes>0</bytes>' \
|
||||
'<content_type>text/plain</content_type>' \
|
||||
@ -752,7 +752,7 @@ class TestContainerController(unittest.TestCase):
|
||||
req = Request.blank('/sda1/p/a/c?prefix=US-&delimiter=-&format=xml',
|
||||
environ={'REQUEST_METHOD': 'GET'})
|
||||
resp = self.controller.GET(req)
|
||||
self.assertEquals(resp.body, '<?xml version="1.0" encoding="UTF-8"?>'
|
||||
self.assertEquals(resp.body, '<?xml version="1.1" encoding="UTF-8"?>'
|
||||
'\n<container name="c"><subdir name="US-OK-"><name>US-OK-</name></subdir>'
|
||||
'<subdir name="US-TX-"><name>US-TX-</name></subdir>'
|
||||
'<subdir name="US-UT-"><name>US-UT-</name></subdir></container>')
|
||||
|
Loading…
Reference in New Issue
Block a user