fix HEAD request incompatible

HEAD requests to S3 respond with the exact same header as a GET,
swift3 responds with an incorrect Content-Type and Content-Length. A
quick hack to fix this issue is below, but should probably be replaced
with something involving DiskFile and such from Swift's API, because
of innecessary overhead involved in reading in the file.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Alric J. Althoff 2012-07-11 11:29:29 +09:00 committed by FUJITA Tomonori
parent 756db939b9
commit f216f1b4f2

View File

@ -331,7 +331,17 @@ class ObjectController(WSGIContext):
object_name)
def GETorHEAD(self, env, start_response):
if env['REQUEST_METHOD'] == 'HEAD':
head = True
env['REQUEST_METHOD'] = 'GET'
else:
head = False
app_iter = self._app_call(env)
if head:
app_iter = None
status = self._get_status_int()
headers = dict(self._response_headers)