summaryrefslogtreecommitdiffstats
path: root/Lib/cgi.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2005-09-19 09:11:04 (GMT)
committerArmin Rigo <arigo@tunes.org>2005-09-19 09:11:04 (GMT)
commit3a703b60593e2bc2ddde232eaad365e4c126ff42 (patch)
treefd0802de882a4a9ccdd9e2024e4f78e40cb2575a /Lib/cgi.py
parentcfe7dd96cf59587d931cadf92a5b6b667cb426b9 (diff)
downloadcpython-3a703b60593e2bc2ddde232eaad365e4c126ff42.zip
cpython-3a703b60593e2bc2ddde232eaad365e4c126ff42.tar.gz
cpython-3a703b60593e2bc2ddde232eaad365e4c126ff42.tar.bz2
Reverted revision 1.83, which introduced a bug and subtle incompatibility
issues. See bug #1112856.
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-xLib/cgi.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index eb96303..41dc433 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -38,7 +38,8 @@ from operator import attrgetter
import sys
import os
import urllib
-import email.Parser
+import mimetools
+import rfc822
import UserDict
try:
from cStringIO import StringIO
@@ -107,8 +108,6 @@ log = initlog # The current logging function
# Parsing functions
# =================
-_header_parser = email.Parser.HeaderParser()
-
# Maximum input we will accept when REQUEST_METHOD is POST
# 0 ==> unlimited input
maxlen = 0
@@ -271,7 +270,7 @@ def parse_multipart(fp, pdict):
data = None
if terminator:
# At start of next part. Read headers first.
- headers = _header_parser.parse(fp)
+ headers = mimetools.Message(fp)
clength = headers.getheader('content-length')
if clength:
try:
@@ -408,9 +407,8 @@ class FieldStorage:
disposition_options: dictionary of corresponding options
- headers: a dictionary(-like) object (sometimes
- email.Message.Message or a subclass thereof) containing *all*
- headers
+ headers: a dictionary(-like) object (sometimes rfc822.Message or a
+ subclass thereof) containing *all* headers
The class is subclassable, mostly for the purpose of overriding
the make_file() method, which is called internally to come up with
@@ -652,7 +650,7 @@ class FieldStorage:
environ, keep_blank_values, strict_parsing)
# Throw first part away
while not part.done:
- headers = _header_parser.parse(self.fp)
+ headers = rfc822.Message(self.fp)
part = klass(self.fp, headers, ib,
environ, keep_blank_values, strict_parsing)
self.list.append(part)