summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cgi.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-10-23 10:54:42 (GMT)
committerGitHub <noreply@github.com>2018-10-23 10:54:42 (GMT)
commit58b614a327991f4baad4d2795a50027f75411450 (patch)
tree67102a8802e90af055d1bab6b1eb693462228d14 /Lib/test/test_cgi.py
parent42892a2a38bb97c41e7b1b154e2b5b6f13d27b57 (diff)
downloadcpython-58b614a327991f4baad4d2795a50027f75411450.zip
cpython-58b614a327991f4baad4d2795a50027f75411450.tar.gz
cpython-58b614a327991f4baad4d2795a50027f75411450.tar.bz2
bpo-35028: cgi: Fix max_num_fields off by one error (GH-9973)
https://bugs.python.org/issue35028 (cherry picked from commit b79b5c09493e98374e48fa122d82dab528fc6e72) Co-authored-by: matthewbelisle-wf <matthew.belisle@workiva.com>
Diffstat (limited to 'Lib/test/test_cgi.py')
-rw-r--r--Lib/test/test_cgi.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py
index 953b99c..b3e2d4c 100644
--- a/Lib/test/test_cgi.py
+++ b/Lib/test/test_cgi.py
@@ -393,33 +393,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):