Merge "Stop digging for publicly_accessible ourselves"

This commit is contained in:
Jenkins 2016-07-05 14:15:28 +00:00 committed by Gerrit Code Review
commit 9f4a662296
2 changed files with 6 additions and 7 deletions

View File

@ -1055,8 +1055,7 @@ class ObjectController(BaseStorageServer):
if req.method not in self.allowed_methods: if req.method not in self.allowed_methods:
res = HTTPMethodNotAllowed() res = HTTPMethodNotAllowed()
else: else:
method = getattr(self, req.method) res = getattr(self, req.method)(req)
res = method(req)
except DiskFileCollision: except DiskFileCollision:
res = HTTPForbidden(request=req) res = HTTPForbidden(request=req)
except HTTPException as error_response: except HTTPException as error_response:

View File

@ -383,11 +383,11 @@ class Application(object):
controller.trans_id = req.environ['swift.trans_id'] controller.trans_id = req.environ['swift.trans_id']
self.logger.client_ip = get_remote_client(req) self.logger.client_ip = get_remote_client(req)
handler = getattr(controller, req.method, None) if req.method not in controller.allowed_methods:
if not getattr(handler, 'publicly_accessible', False): return HTTPMethodNotAllowed(request=req, headers={
allowed_methods = getattr(controller, 'allowed_methods', set()) 'Allow': ', '.join(controller.allowed_methods)})
return HTTPMethodNotAllowed( handler = getattr(controller, req.method)
request=req, headers={'Allow': ', '.join(allowed_methods)})
old_authorize = None old_authorize = None
if 'swift.authorize' in req.environ: if 'swift.authorize' in req.environ:
# We call authorize before the handler, always. If authorized, # We call authorize before the handler, always. If authorized,