CGI Redirect

piet at cs.uu.nl piet at cs.uu.nl
Wed May 2 10:08:57 EDT 2001


>>>>> Ben Ocean <zope at thewebsons.com> (BO) writes:

BO> Here's my code. Can you tell me where I'm going wrong? (Everything gets
BO> replaced like it should, it's just the aforementioned error.)
>>>> 
BO> #!/usr/bin/python

BO> import os, sys, cgi, string

BO> FormData = cgi.FieldStorage()
BO> print "Content-type: text/html\n\n"

There's an error. It prints 3 newlines (on generated by print itself).
That's two empty lines. The first empty line ends your headers, the second
empty line is the first line of your document (which will be harmless
because it's supposed to be HTML.
Your supposed Location: header is now part of your document body and the
browser tries to understand it as HTML.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the Python-list mailing list