On 11/21/2010 8:39 PM, R. David Murray wrote: > On Sun, 21 Nov 2010 19:59:54 -0800, Glenn Linderman<v+python at g.nevcal.com> wrote: >> On 11/21/2010 9:18 AM, R. David Murray wrote: >>> I want to look at the CGI issue, but I'm not sure when I'll get to it. >> Actually, since this code was working before 3.x, and if email.parser >> can now accept binary streams, it seems like maybe the only thing that >> might be wrong is that presently it is getting a text stream instead, so >> that is something cgi.py or the application program would have to >> switch, and then maybe some testing would discover correctness, or maybe >> a specification of UTF-8 as the encoding to use for the text parts would >> have to be done. > Well, given the bytes/string split in Python3, code definitely has to > be changed to make this work, since you have to explicitly call bytes > processing routines (message_from_bytes, message_from_binary_file, > BytesFeedparser, etc) to parse binary data, and likewise use > BytesGenerator to emit binary data. Looks like cgi.py also calls http.client and both of them would need to be changed to deal with bytes. I don't have the full translation of API calls in my head, nor have I ever used the email.parser API to know what the calls actually do... just read a bit about it... but that is different than using it... However, I find code in http.client.parse_headers that is attempting to work-around reading a binary stream and feeding email.parser a string. So definitely some work to be done to fix things. I did add some explicit threads to http.server CGI script code that I think work around the deadlocks that can result from attempting to serialize 3 pipes, and yet not require full buffering of stdin or stdout. At the moment, I still am doing full buffering of stderr, but that is thought to be small potatoes in an http.server environment, generally. But since my test case is a CGI form data, I'm stuck until this is fixed, or I wrap my head around the code in http.client and email.parser. But not tonight (yawn!). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20101123/865d1747/attachment-0001.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4