Skip to content

Commit

Permalink
Add check of performance of ipv6 check
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHuot committed Sep 2, 2022
1 parent 0adbbe1 commit e514826
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_uri_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ def test_is_absolute_uri(self):
self.assertIsNone(is_absolute_uri('wrong'))
self.assertIsNone(is_absolute_uri('http://[:1]:38432/path'))
self.assertIsNone(is_absolute_uri('http://[abcd:efgh::1]/'))

def test_recursive_regex(self):
from datetime import datetime
t0 = datetime.now()
self.assertIsNone(is_absolute_uri('http://[::::::::::::::::::::::::::]/path'))
t1 = datetime.now()
spent = t1 - t0
self.assertGreater(0.1, spent.total_seconds(), "possible recursive loop detected")

0 comments on commit e514826

Please sign in to comment.