On 11/21/2010 8:39 PM, R. David Murray wrote:
On Sun, 21 Nov 2010 19:59:54 -0800, Glenn Linderman<v+pyt...@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!).
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com