cpython: 3d7000549eb1 (original) (raw)

Mercurial > cpython

changeset 81676:3d7000549eb1

merge from 3.3 Issue #12411: Fix to cgi.parse_multipart to correctly use bytes boundaries and bytes data. Patch by Jonas Wagner. [#12411]

Senthil Kumaran senthil@uthcode.com
date Wed, 23 Jan 2013 03:01:23 -0800
parents 02e7da4c4fe3(current diff)59ea872d8b6b(diff)
children cd87afe18ff8
files Lib/cgi.py Misc/NEWS
diffstat 3 files changed, 30 insertions(+), 9 deletions(-)[+] [-] Lib/cgi.py 18 Lib/test/test_cgi.py 18 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -223,17 +223,17 @@ def parse_multipart(fp, pdict): """ import http.client

while terminator != lastpart: bytes = -1 @@ -252,7 +252,7 @@ def parse_multipart(fp, pdict): raise ValueError('Maximum content length exceeded') data = fp.read(bytes) else:

@@ -260,7 +260,7 @@ def parse_multipart(fp, pdict): if not line: terminator = lastpart # End outer loop break

@@ -272,12 +272,12 @@ def parse_multipart(fp, pdict): if lines: # Strip final line terminator line = lines[-1]

--- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -5,6 +5,7 @@ import sys import tempfile import unittest import warnings +from collections import namedtuple from io import StringIO, BytesIO class HackedSysModule: @@ -119,6 +120,23 @@ def gen_result(data, environ): class CgiTests(unittest.TestCase):

+

+ def test_escape(self): # cgi.escape() is deprecated. with warnings.catch_warnings():

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -220,6 +220,9 @@ Core and Builtins Library ------- +- Issue #12411: Fix to cgi.parse_multipart to correctly use bytes boundaries