Graham Dumpleton
graham.dumpleton at gmail.com
Mon Mar 24 01:26:37 EDT 2008
On 24/03/2008, David Champion <dgc at uchicago.edu> wrote: > > Without seeing your Apache configuration for setting up the handlers > > and the code of the actual handlers, can't really say why you may be > > having a problem. > > > I get the same results without any of my own authN code. It seems to be > some really basic issue with mod_python or my use of it. > > unix$ tail -7 httpd.conf > <Location /test> > PythonDebug On > SetHandler mod_python Don't define SetHandler here. This says that mod_python is handling the content phase which you don't want as you want your CGI script to do that. Ie., only define SetHandler or AddHandler as appropriate when using PythonHandler directive. Graham > PythonHeaderParserHandler Example::handler > PythonPath "sys.path + ['/home/dgc/lib/python']" > </Location> > > unix$ cat Example.py > from mod_python import apache > > def handler(req): > return apache.DECLINED > > unix$ cat <<XXX >/httpd/test/env.cgi > #!/usr/bin/python > > import sys > import os > import cgi > import cgitb > > def main(): > print "Content-Type: text/html" > print > cgi.print_environ() > > if not os.isatty(0): > cgitb.enable() > if __name__ == "__main__": > main() > XXX > > Loading http://server/test/env.cgi in a browser dumps the text of the > CGI script to me as Content-type: text/html. Without the <Location/> > block, it works as a CGI should. > > > -- > -D. dgc at uchicago.edu NSIT University of Chicago >
|