allow / to pass through ratelimit

Change-Id: I891c5ea48511ca9ad47f2adbcbee700d63a4231d
This commit is contained in:
David Goetz 2012-03-26 18:00:19 -07:00
parent f218081ce9
commit 7fc02b424f
2 changed files with 3 additions and 3 deletions

View File

@ -220,7 +220,7 @@ class RateLimitMiddleware(object):
try:
version, account, container, obj = split_path(req.path, 1, 4, True)
except ValueError:
return HTTPNotFound()(env, start_response)
return self.app(env, start_response)
ratelimit_resp = self.handle_ratelimit(req, account, container, obj)
if ratelimit_resp is None:
return self.app(env, start_response)

View File

@ -378,7 +378,7 @@ class TestRateLimit(unittest.TestCase):
'swift.cache': FakeMemcache(),
'SERVER_PROTOCOL': 'HTTP/1.0'}
app = lambda *args, **kwargs: None
app = lambda *args, **kwargs: ['fake_app']
rate_mid = ratelimit.RateLimitMiddleware(app, {},
logger=FakeLogger())
@ -387,7 +387,7 @@ class TestRateLimit(unittest.TestCase):
def __call__(self, *args, **kwargs):
pass
resp = rate_mid.__call__(env, a_callable())
self.assert_('404 Not Found' in resp[0])
self.assert_('fake_app' == resp[0])
def test_no_memcache(self):
current_rate = 13