On 14 August 2002, paul_chakravarti said:
> I had a similar problem running under MacOSX 10.1.5 & tracked the
> problem down to the FCGI test in the _startup function
> (fcgi.py:373) - this checks whether stdin is actually a socket by
> attempting to call getpeername() on the fd however for some reason
> the call appears to behave strangely on OSX when running via CGI.
Ahh, this is *tantalizingly* close to what I need to fix the problem
once and for all. Can someone (anyone!) with OS X try this CGI script
instead of Paul's:
-- peername.cgi -------------------------------------------
#!/usr/bin/env python
import sys, socket, errno
print "Content-Type: text/plain\n"
print "ENOTCONN = %d" % errno.ENOTCONN
print "ENOTSOCK = %d" % errno.ENOTSOCK
try:
s = socket.fromfd(sys.stdin.fileno(),
socket.AF_INET,
socket.SOCK_STREAM)
s.getpeername()
except socket.error, err:
print err
-----------------------------------------------------------
On Linux, I get this:
ENOTCONN = 107
ENOTSOCK = 88
(88, 'Socket operation on non-socket')
As expected, it doesn't matter whether I run the script via a web server
(ie. as a real CGI script) or from the command-line -- Linux barfs the
same way both times. Good. Based on Paul's mail from August, OpenBSD
acts like Linux (but with a different errno), and OS X inexplicably
behaves differently when the script is run from a web server.
What I need to know is the errno (preferably symbolic) OS X returns when
run as a CGI script. Please help!
Greg
--
Greg Ward - software developer gward@mems-exchange.org
MEMS Exchange http://www.mems-exchange.org