Skip to content

Commit 3a703b6

Browse files
committed
Reverted revision 1.83, which introduced a bug and subtle incompatibility
issues. See bug #1112856.
1 parent cfe7dd9 commit 3a703b6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Lib/cgi.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
import sys
3939
import os
4040
import urllib
41-
import email.Parser
41+
import mimetools
42+
import rfc822
4243
import UserDict
4344
try:
4445
from cStringIO import StringIO
@@ -107,8 +108,6 @@ def nolog(*allargs):
107108
# Parsing functions
108109
# =================
109110

110-
_header_parser = email.Parser.HeaderParser()
111-
112111
# Maximum input we will accept when REQUEST_METHOD is POST
113112
# 0 ==> unlimited input
114113
maxlen = 0
@@ -271,7 +270,7 @@ def parse_multipart(fp, pdict):
271270
data = None
272271
if terminator:
273272
# At start of next part. Read headers first.
274-
headers = _header_parser.parse(fp)
273+
headers = mimetools.Message(fp)
275274
clength = headers.getheader('content-length')
276275
if clength:
277276
try:
@@ -408,9 +407,8 @@ class FieldStorage:
408407
409408
disposition_options: dictionary of corresponding options
410409
411-
headers: a dictionary(-like) object (sometimes
412-
email.Message.Message or a subclass thereof) containing *all*
413-
headers
410+
headers: a dictionary(-like) object (sometimes rfc822.Message or a
411+
subclass thereof) containing *all* headers
414412
415413
The class is subclassable, mostly for the purpose of overriding
416414
the make_file() method, which is called internally to come up with
@@ -652,7 +650,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing):
652650
environ, keep_blank_values, strict_parsing)
653651
# Throw first part away
654652
while not part.done:
655-
headers = _header_parser.parse(self.fp)
653+
headers = rfc822.Message(self.fp)
656654
part = klass(self.fp, headers, ib,
657655
environ, keep_blank_values, strict_parsing)
658656
self.list.append(part)

0 commit comments

Comments
 (0)