diff options
author | matthewbelisle-wf <matthew.belisle@workiva.com> | 2018-10-23 08:14:35 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-10-23 08:14:35 (GMT) |
commit | b79b5c09493e98374e48fa122d82dab528fc6e72 (patch) | |
tree | 6ade2e36fa33a07aee88cbcec162c8f885e18a81 /Lib/test/test_cgi.py | |
parent | b7d62050e7d5fc208ae7673613da4f1f2bc565c4 (diff) | |
download | cpython-b79b5c09493e98374e48fa122d82dab528fc6e72.zip cpython-b79b5c09493e98374e48fa122d82dab528fc6e72.tar.gz cpython-b79b5c09493e98374e48fa122d82dab528fc6e72.tar.bz2 |
bpo-35028: cgi: Fix max_num_fields off by one error (GH-9973)
https://bugs.python.org/issue35028
Diffstat (limited to 'Lib/test/test_cgi.py')
-rw-r--r-- | Lib/test/test_cgi.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py index 8ea9d6a..b86638e 100644 --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -401,33 +401,38 @@ Larry data = """---123 Content-Disposition: form-data; name="a" -a +3 ---123 Content-Type: application/x-www-form-urlencoded -a=a&a=a +a=4 +---123 +Content-Type: application/x-www-form-urlencoded + +a=5 ---123-- """ environ = { 'CONTENT_LENGTH': str(len(data)), 'CONTENT_TYPE': 'multipart/form-data; boundary=-123', - 'QUERY_STRING': 'a=a&a=a', + 'QUERY_STRING': 'a=1&a=2', 'REQUEST_METHOD': 'POST', } # 2 GET entities - # 2 top level POST entities - # 2 entities within the second POST entity + # 1 top level POST entities + # 1 entity within the second POST entity + # 1 entity within the third POST entity with self.assertRaises(ValueError): cgi.FieldStorage( fp=BytesIO(data.encode()), environ=environ, - max_num_fields=5, + max_num_fields=4, ) cgi.FieldStorage( fp=BytesIO(data.encode()), environ=environ, - max_num_fields=6, + max_num_fields=5, ) def testQSAndFormData(self): |