cgi binary stdout
Steve Holden
sholden at holdenweb.com
Wed Feb 13 12:23:24 EST 2002
"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote ...
> Does anyone know how stdout should be configured in cgi scripts. It
> suddenly occurred to me that IIS/Apache running on win32 might not pass
> stdout configured as binary. Does the CGI script have to ensure that it
> is writing to a binary stream or can it assume the server does that?
Of course, this will depend to an extend on your server. However, I seem to
remember that if you want to do it it's relatively simple (ferkles in
codestash...) aah, yes, try this snippet I stole from MoinMoin:
# force input/output to binary
if sys.platform == "win32":
import msvcrt
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
regards
Steve
--
Consulting, training, speaking: http://www.holdenweb.com/
Author, Python Web Programming: http://pydish.holdenweb.com/pwp/
"This is Python. We don't care much about theory, except where it
intersects with useful practice." Aahz Maruch on c.l.py
More information about the Python-list
mailing list