Skip to content
Snippets Groups Projects
Commit 3ed14cc6 authored by Stuart Gathman's avatar Stuart Gathman
Browse files

Heuristic for invalid source route.

parent aeff1f8a
No related branches found
No related merge requests found
...@@ -101,6 +101,8 @@ def parse_addr(t): ...@@ -101,6 +101,8 @@ def parse_addr(t):
['foo'] ['foo']
>>> parse_addr('@mx.example.com:user@example.com') >>> parse_addr('@mx.example.com:user@example.com')
['user', 'example.com'] ['user', 'example.com']
>>> parse_addr('@user@example.com')
['@user', 'example.com']
""" """
if t.startswith('<') and t.endswith('>'): t = t[1:-1] if t.startswith('<') and t.endswith('>'): t = t[1:-1]
if t.startswith('"'): if t.startswith('"'):
...@@ -108,7 +110,8 @@ def parse_addr(t): ...@@ -108,7 +110,8 @@ def parse_addr(t):
pos = t.find('"@') pos = t.find('"@')
if pos > 0: return [t[1:pos],t[pos+2:]] if pos > 0: return [t[1:pos],t[pos+2:]]
if t.startswith('@'): if t.startswith('@'):
t = t.split(':',1)[1] try: t = t.split(':',1)[1]
except IndexError: pass
return t.rsplit('@',1) return t.rsplit('@',1)
## Decode headers gratuitously encoded to hide the content. ## Decode headers gratuitously encoded to hide the content.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment