sys.exit(1)
handler = handlermod.application
+class closed(IOError):
+ def __init__(self):
+ super(closed, self).__init__("The client has closed the connection.")
+
cwd = os.getcwd()
def absolutify(path):
if path[0] != '/':
else:
buf += c
return buf
+
def dowsgi(req):
env = {}
env["wsgi.version"] = 1, 0
if not data:
return
flushreq()
- req.sk.write(data)
- req.sk.flush()
+ try:
+ req.sk.write(data)
+ req.sk.flush()
+ except IOError:
+ raise closed()
def startreq(status, headers, exc_info = None):
if resp:
class protoerr(Exception):
pass
+class closed(IOError):
+ def __init__(self):
+ super(closed, self).__init__("The client has closed the connection.")
+
def readns(sk):
hln = 0
while True:
def write(data):
if not data:
return
- flushreq()
- sk.write(data)
- sk.flush()
+ try:
+ flushreq()
+ sk.write(data)
+ sk.flush()
+ except IOError:
+ raise closed()
def startreq(status, headers, exc_info = None):
if resp: