diff options
| author | Marc Tamlyn <marc.tamlyn@gmail.com> | 2012-08-18 12:00:52 +0100 |
|---|---|---|
| committer | Marc Tamlyn <marc.tamlyn@gmail.com> | 2012-08-18 12:08:44 +0100 |
| commit | bfa9fc69bf0afae907af0ba3ef2cab8e10a4fa61 (patch) | |
| tree | ccaf6fd408887376d664d02fab31680b8a834cb2 /django | |
| parent | 16ab519f62f4418a8cff143ea92e642ae89bb2cf (diff) | |
Fixed #18779 -- URLValidator can't validate url with ipv6.
Validation is reasonably 'soft', as for the ipv4. False positives don't
matter too much here.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/validators.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/validators.py b/django/core/validators.py index 1a714c5472..934f7d1d77 100644 --- a/django/core/validators.py +++ b/django/core/validators.py @@ -44,7 +44,8 @@ class URLValidator(RegexValidator): r'^(?:http|ftp)s?://' # http:// or https:// r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain... r'localhost|' #localhost... - r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip + r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|' # ...or ipv4 + r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6 r'(?::\d+)?' # optional port r'(?:/?|[/?]\S+)$', re.IGNORECASE) |
