durusmail: quixote-users: CGIHTTPServer
CGIHTTPServer
2003-05-22
2003-05-22
Re: CGIHTTPServer
2003-05-22
2003-05-22
2003-05-22
2003-05-22
Re: CGIHTTPServer
2003-05-22
2003-05-23
CGIHTTPServer
Neil Schemenauer
2003-06-19
On Mon, May 19, 2003 at 04:00:45PM -0400, Mark Bucciarelli wrote:
> I can't get Quixote to work with Python's CGIHTTPServer.  This issue
> was raised back in March of 2002, and Greg Ward suggested that the
> reason is that Python's CGIHTTPRequestHandler fills stdin differently
> than Apache.
>
> The call to _sock.accept() in line 243 of fcgi.py raises a
> socket.error 22 ('Invalid argument').

I expect the isFCGI test in fcgi.py is getting confused.  It looks like
the test is supposed to fail if sys.stdin is not a socket.  You could
fix it by replacing the publish_cgi function with:

    def publish_cgi (self):
        # On Windows sys.stdout is opened in text mode by default
        if sys.platform == "win32":
            import msvcrt
            msvcrt.setmode(sys.__stdout__.fileno(), os.O_BINARY)
        self.publish(sys.__stdin__, sys.__stdout__, sys.__stderr__, os.environ)


Untested of course.  Does anyone think we should have both publish_cgi
and publish_fcgi?

  Neil

reply