]> khamidou — GitHub mirrors - flanker.git/commitdiff
Bumped local part limit to 256, from 128, to support long List-Unsubscribe addresses.
authorTravis Swientek <travis@mailgunhq.com>
Fri, 7 Feb 2014 00:46:34 +0000 (00:46 +0000)
committerTravis Swientek <travis@mailgunhq.com>
Fri, 7 Feb 2014 00:46:34 +0000 (00:46 +0000)
flanker/addresslib/parser.py
tests/addresslib/parser_mailbox_test.py
tests/fixtures/mailbox_invalid.txt

index cb1e4662d7f6dabce63e6376958bbc995fdc3d84..4c2ac61497dc585249ab094c94ceeae14c4ac176 100644 (file)
@@ -185,11 +185,11 @@ class _AddressParser(object):
         "Additional post processing checks to ensure mailbox is valid."
         parts = address.split('@')
 
-        # check if local part is less than 128 octets, the actual
-        # limit is 64 octets but we double the size here because
+        # check if local part is less than 256 octets, the actual
+        # limit is 64 octets but we quadruple the size here because
         # unsubscribe links are frequently longer
         lpart = parts[0]
-        if len(lpart) > 128:
+        if len(lpart) > 256:
             return False
 
         # check if the domain is less than 255 octets
index 0127e6375e0a7db48d3744278828efacefb62430..a9a3cd22b82af09d69ded70fb82c7ae4b7b0c510 100644 (file)
@@ -469,7 +469,7 @@ def test_local_part():
 
     # test length limits
     run_mailbox_test(''.join(['a'*128, '@b']), ''.join(['a'*128, '@b']))
-    run_mailbox_test(''.join(['a'*129, '@b']), None)
+    run_mailbox_test(''.join(['a'*257, '@b']), None)
 
     # because qtext and quoted-pair are longer than 64 bytes (limit on local-part)
     # we use a sample in testing, every other for qtext and every fifth for quoted-pair
index 90adfc466df1412b07017619cd6d1d18f86deba7..2c430634bd5c919e777796b72c0d2a1279f8685d 100644 (file)
@@ -21,7 +21,7 @@ this\ still\"not\\allowed@example.com
 first.last@sub.do,com
 first\@last@iana.org
 first.last
-123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@iana.org
+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912@iana.org
 .first.last@iana.org
 first.last.@iana.org
 first..last@iana.org