Skip to content

Commit 5820e7b

Browse files
AymericDufvennetier
authored andcommitted
proxy-logging: Try to match regex only if user-agent is present
1 parent 2022d53 commit 5820e7b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

oioswift/common/middleware/proxy_logging.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ def __call__(self, env, start_response):
9494
add_perfata = True
9595
else:
9696
req = Request(env)
97-
for pat in self.perfdata_user_agents:
98-
if pat.match(req.user_agent):
99-
add_perfata = True
100-
break
97+
if req.user_agent:
98+
for pat in self.perfdata_user_agents:
99+
if pat.match(req.user_agent):
100+
add_perfata = True
101+
break
101102
if add_perfata:
102103
env.setdefault('oio.perfdata', dict())
103104
return super(OioProxyLoggingMiddleware, self).__call__(

0 commit comments

Comments
 (0)