summaryrefslogtreecommitdiff
path: root/thfcgi.py
diff options
context:
space:
mode:
authorrichard <devnull@localhost>2009-11-05 05:55:15 +0000
committerrichard <devnull@localhost>2009-11-05 05:55:15 +0000
commit484a4c8e184c373a9da587b1f63461c86dfa5894 (patch)
tree13de5df4d90a1508fdeb428ae5c42761156f5fb3 /thfcgi.py
parentd00aaa4963b15af7735e2ab58656aa3bc5520b4a (diff)
downloaddecorator-484a4c8e184c373a9da587b1f63461c86dfa5894.tar.gz
committing changes from running server (all robustification)
Diffstat (limited to 'thfcgi.py')
-rw-r--r--thfcgi.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/thfcgi.py b/thfcgi.py
index 9902bd8..b83b328 100644
--- a/thfcgi.py
+++ b/thfcgi.py
@@ -45,6 +45,7 @@ import errno
import cgi
from cStringIO import StringIO
import struct
+import syslog
try:
import threading as _threading
@@ -236,8 +237,10 @@ class Record:
try:
sock.sendall(hdr + content + padlen*"\x00")
- except socket.error:
- # Write error, probably broken pipe. Exit.
+ except socket.error, e:
+ # Write error, probably broken pipe. Close connection
+ syslog.syslog(str(e))
+ sock.close()
raise SocketErrorOnWrite
@@ -361,6 +364,7 @@ class Request:
if not self.keep_conn:
self.conn.close()
if self.inthread:
+ syslog.syslog("Exiting: inthread and not keep_conn")
raise SystemExit
#
@@ -527,7 +531,10 @@ class FCGI:
req = Request(conn, self.req_handler, inthread)
req.run()
except SocketErrorOnWrite:
- raise SystemExit
+ syslog.syslog("Exiting: SocketErrorOnWrite")
+ # this used to exit the FCGI server. Now just discard this
+ # connection, and go on accepting the next one
+ #raise SystemExit
def _make_socket(self):
"""Create socket and verify FCGI environment."""