Merge "Move calls to self.app outside of error handling"

This commit is contained in:
Zuul 2019-07-12 22:12:28 +00:00 committed by Gerrit Code Review
commit b202292338
8 changed files with 27 additions and 1 deletions

View File

@ -225,7 +225,10 @@ class ServerSideCopyMiddleware(object):
req = Request(env)
try:
(version, account, container, obj) = req.split_path(4, 4, True)
is_obj_req = True
except ValueError:
is_obj_req = False
if not is_obj_req:
# If obj component is not present in req, do not proceed further.
return self.app(env, start_response)

View File

@ -433,7 +433,10 @@ class Decrypter(object):
req = Request(env)
try:
parts = req.split_path(3, 4, True)
is_cont_or_obj_req = True
except ValueError:
is_cont_or_obj_req = False
if not is_cont_or_obj_req:
return self.app(env, start_response)
if parts[3] and req.method in ('GET', 'HEAD'):

View File

@ -420,7 +420,10 @@ class DynamicLargeObject(object):
req = Request(env)
try:
vrs, account, container, obj = req.split_path(4, 4, True)
is_obj_req = True
except ValueError:
is_obj_req = False
if not is_obj_req:
return self.app(env, start_response)
if ((req.method == 'GET' or req.method == 'HEAD') and

View File

@ -128,6 +128,10 @@ class ListingFilter(object):
# account and container only
version, acct, cont = req.split_path(2, 3)
except ValueError:
is_container_req = False
else:
is_container_req = True
if not is_container_req:
return self.app(env, start_response)
if not valid_api_version(version) or req.method not in ('GET', 'HEAD'):

View File

@ -119,7 +119,11 @@ class ListingEtagMiddleware(object):
if not valid_api_version(v):
raise ValueError
except ValueError:
# not a container request; pass through
is_container_req = False
else:
is_container_req = True
if not is_container_req:
# pass through
return self.app(env, start_response)
ctx = WSGIContext(self.app)

View File

@ -1511,7 +1511,10 @@ class StaticLargeObject(object):
req = Request(env)
try:
vrs, account, container, obj = req.split_path(3, 4, True)
is_cont_or_obj_req = True
except ValueError:
is_cont_or_obj_req = False
if not is_cont_or_obj_req:
return self.app(env, start_response)
if not obj:

View File

@ -551,7 +551,10 @@ class SymlinkMiddleware(object):
req = Request(env)
try:
version, acc, cont, obj = req.split_path(3, 4, True)
is_cont_or_obj_req = True
except ValueError:
is_cont_or_obj_req = False
if not is_cont_or_obj_req:
return self.app(env, start_response)
try:

View File

@ -814,7 +814,10 @@ class VersionedWritesMiddleware(object):
req = Request(env)
try:
(api_version, account, container, obj) = req.split_path(3, 4, True)
is_cont_or_obj_req = True
except ValueError:
is_cont_or_obj_req = False
if not is_cont_or_obj_req:
return self.app(env, start_response)
# In case allow_versioned_writes is set in the filter configuration,