mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Finally fix the XXX we had for httpUrlRe and urlRe
This commit is contained in:
parent
75c300c6b0
commit
3d5c877f80
@ -45,9 +45,15 @@ urlunquote = urllib.unquote
|
|||||||
class Error(Exception):
|
class Error(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# XXX We should tighten this up a bit.
|
octet = r'(?:2(?:[0-4]\d|5[0-5])|1\d\d|\d{1,2})'
|
||||||
urlRe = re.compile(r"(\w+://[^\])>\s]+)", re.I)
|
ipAddr = r'%s(?:\.%s){3}' % (octet, octet)
|
||||||
httpUrlRe = re.compile(r"(https?://[^\])>\s]+)", re.I)
|
# Base domain regex off RFC 1034 and 1738
|
||||||
|
label = r'[0-9a-z][-0-9a-z]*[0-9a-z]?'
|
||||||
|
domain = r'%s(?:\.%s)*\.[a-z][-0-9a-z]*[a-z]?' % (label, label)
|
||||||
|
urlRe = re.compile(r'(\w+://(?:%s|%s)(?::\d+)?(?:/[^\])>\s]*)?)'
|
||||||
|
% (domain, ipAddr), re.I)
|
||||||
|
httpUrlRe = re.compile(r'(https?://(?:%s|%s)(?::\d+)?(?:/[^\])>\s]*)?)'
|
||||||
|
% (domain, ipAddr), re.I)
|
||||||
|
|
||||||
REFUSED = 'Connection refused.'
|
REFUSED = 'Connection refused.'
|
||||||
TIMED_OUT = 'Connection timed out.'
|
TIMED_OUT = 'Connection timed out.'
|
||||||
|
Loading…
Reference in New Issue
Block a user