Message107405
| Author |
gvanrossum |
| Recipients |
MLModel, georg.brandl, ggenellina, gvanrossum |
| Date |
2010年06月09日.16:57:13 |
| SpamBayes Score |
1.872523e-05 |
| Marked as misclassified |
No |
| Message-id |
<1276102635.71.0.0321536018137.issue8077@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The example works for me if I make this change:
--- Lib/cgi.py (revision 81862)
+++ Lib/cgi.py (working copy)
@@ -608,7 +608,7 @@
parser = email.parser.FeedParser()
# Create bogus content-type header for proper multipart parsing
parser.feed('Content-Type: %s; boundary=%s\r\n\r\n' % (self.type, ib))
- parser.feed(self.fp.read())
+ parser.feed(self.fp.read(self.length))
full_msg = parser.close()
# Get subparts
msgs = full_msg.get_payload()
However this seems iffy to me because the content length presumably counts bytes whereas self.fp seems to be a text file, but since most HTTP clients don't close the connection, without some kind of boundary on the read() call it just hangs forever.
Also someone pointed out to me offline that this change may be needed, separately (though I haven't confirmed this yet):
--- Lib/cgi.py (revision 81862)
+++ Lib/cgi.py (working copy)
@@ -233,6 +233,7 @@
lines = []
while 1:
line = fp.readline()
+ line = line.decode()
if not line:
terminator = lastpart # End outer loop
break |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年06月09日 16:57:16 | gvanrossum | set | recipients:
+ gvanrossum, georg.brandl, ggenellina, MLModel |
| 2010年06月09日 16:57:15 | gvanrossum | set | messageid: <1276102635.71.0.0321536018137.issue8077@psf.upfronthosting.co.za> |
| 2010年06月09日 16:57:13 | gvanrossum | link | issue8077 messages |
| 2010年06月09日 16:57:13 | gvanrossum | create |
|