]> khamidou — GitHub mirrors - flanker.git/commitdiff
Updated address length check to 1024 characters because many unsubscribe v0.4.15
authorRussell Jones <rjones@mailgunhq.com>
Fri, 11 Jul 2014 07:20:33 +0000 (00:20 -0700)
committerRussell Jones <rjones@mailgunhq.com>
Fri, 11 Jul 2014 07:20:33 +0000 (00:20 -0700)
links were much larger than our old limit (which was already 4x the RFC limit).
New limit is 16x the RFC limit.

Bumped the version of dnsq and expiringdict.

Moved mock and nose from install_requires to tests_require.

flanker/addresslib/parser.py
setup.py
tests/addresslib/parser_mailbox_test.py
tests/fixtures/mailbox_invalid.txt

index 4c2ac61497dc585249ab094c94ceeae14c4ac176..509e7a4e599ddb39e5b3be23dac4fe6417628b16 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 256 octets, the actual
-        # limit is 64 octets but we quadruple the size here because
+        # check if local part is less than 1024 octets, the actual
+        # limit is 64 octets but we allow 16x that size here because
         # unsubscribe links are frequently longer
         lpart = parts[0]
-        if len(lpart) > 256:
+        if len(lpart) > 1024:
             return False
 
         # check if the domain is less than 255 octets
@@ -611,6 +611,6 @@ class ParserException(Exception):
 
 
 
-MAX_ADDRESS_LENGTH = 512
+MAX_ADDRESS_LENGTH = 1280
 MAX_ADDRESS_NUMBER = 1024
 MAX_ADDRESS_LIST_LENGTH = MAX_ADDRESS_LENGTH * MAX_ADDRESS_NUMBER
index 4cd3b9a037c239ce86a8769783d84340c5fcfada..e913f9cd9f2719638b0a7a94559b502ec9fa8075 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ from setuptools import setup, find_packages
 
 
 setup(name='flanker',
-      version='0.4.14',
+      version='0.4.15',
       description='Mailgun Parsing Tools',
       long_description=open('README.rst').read(),
       classifiers=[],
@@ -17,12 +17,14 @@ setup(name='flanker',
       packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
       include_package_data=True,
       zip_safe=True,
+      tests_require=[
+          'nose',
+          'mock'
+      ],
       install_requires=[
           'chardet>=1.0.1',
-          'dnsq>=1.1',
-          'expiringdict>=1.1',
-          'mock>=1.0.1',
-          'nose>=1.2.1',
+          'dnsq>=1.1.3',
+          'expiringdict>=1.1.2',
           'Paste>=1.7.5',
           'redis>=2.7.1',
           # IMPORTANT! Newer regex versions are a lot slower for
index 465083151dcbd47321c7c9db4817e3cef766eaa3..3ea39d1244e20c6f3b26aaaa4cb7c8dab5ebb0f5 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'*257, '@b']), None)
+    run_mailbox_test(''.join(['a'*1025, '@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 2c430634bd5c919e777796b72c0d2a1279f8685d..fded219d7554818063e32f55ce92a484a3cb5ce5 100644 (file)
@@ -21,7 +21,7 @@ this\ still\"not\\allowed@example.com
 first.last@sub.do,com
 first\@last@iana.org
 first.last
-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912345678912@iana.org
+01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234@example.com
 .first.last@iana.org
 first.last.@iana.org
 first..last@iana.org