Index: fcgi.py =================================================================== RCS file: /home/cvs/quixote/fcgi.py,v retrieving revision 1.8 diff -u -r1.8 fcgi.py --- fcgi.py 20 Nov 2002 17:06:06 -0000 1.8 +++ fcgi.py 20 Nov 2002 20:48:42 -0000 @@ -384,16 +384,17 @@ return _init = 1 + s = socket.fromfd(sys.stdin.fileno(), socket.AF_INET, socket.SOCK_STREAM) try: - s = socket.fromfd(sys.stdin.fileno(), socket.AF_INET, - socket.SOCK_STREAM) - s.getpeername() - except socket.error, (err, errmsg): - if err != errno.ENOTCONN: # must be a non-fastCGI environment - _isFCGI = 0 - return - - _sock = s + s.getsockname() + except socket.error: + # stdin not a socket -- must be a non-FastCGI environment. + _isFCGI = 0 + s.close() + return + else: + # stdin is a socket -- must be in a FastCGI environment. + _sock = s #---------------------------------------------------------------------------