Author tobias
Recipients amaury.forgeotdarc, barry, ggenellina, oopos, r.david.murray, tercero12, tobias
Date 2009-08-10.13:50:35
SpamBayes Score 5.91976e-10
Marked as misclassified No
Message-id <1249912237.3.0.973444037857.issue4953@psf.upfronthosting.co.za>
In-reply-to
Content
Actually, I think this whole issue is more complex. For example,
consider a (fictious) CGI script where users can upload an image and a
description and the script sends a success/error message in return.

In this case, one has to:
- read the HTTP request header from stdin as US-ASCII
- read the image from stdin as raw binary data
- read the description from stdin as a string in some encoding
- write the HTTP response header to stdout as US-ASCII
- write the response message to stdout in some (other) encoding
- write error messages to server log via stderr as US-ASCII
Also, there are cases when a cgi script should return binary data
instead (e.g., images or archive files) or apply a transfer encoding
(e.g., gzip).

Although FieldStorage only cares about reading, it still has to cope
with intermixed textual and binary data. So the only practical way in my
opinion is to use raw binary data and have FieldStorage decode strings
on demand, since only the programmer knows whether a field should
contain text or binary data. FieldStorage should offer two methods for
this purpose: one for reading binary data and another for reading and
decoding strings on-the-fly (possibly using a default encoding passed to
its constructor).
History
Date User Action Args
2009-08-10 13:50:37tobiassetrecipients: + tobias, barry, amaury.forgeotdarc, ggenellina, r.david.murray, oopos, tercero12
2009-08-10 13:50:37tobiassetmessageid: <1249912237.3.0.973444037857.issue4953@psf.upfronthosting.co.za>
2009-08-10 13:50:35tobiaslinkissue4953 messages
2009-08-10 13:50:35tobiascreate