X-Git-Url: http://www.dolda2000.com/gitweb/?a=blobdiff_plain;f=python%2Fashd-wsgi;h=bfc4b420d7d12f7354a6f8e8370f6203e9aed173;hb=1b16086880096c31abd31fa2dae40e5b36789162;hp=92a254a7c01babc2297b2ea085ac17e49f36de78;hpb=370d235f493d0e5ef9fc8de28c4e230f49beab8c;p=ashd.git diff --git a/python/ashd-wsgi b/python/ashd-wsgi index 92a254a..bfc4b42 100755 --- a/python/ashd-wsgi +++ b/python/ashd-wsgi @@ -36,6 +36,10 @@ else: 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] != '/': @@ -74,6 +78,7 @@ def unquoteurl(url): else: buf += c return buf + def dowsgi(req): env = {} env["wsgi.version"] = 1, 0 @@ -129,9 +134,12 @@ def dowsgi(req): def write(data): if not data: return - flushreq() - req.sk.write(data) - req.sk.flush() + try: + flushreq() + req.sk.write(data) + req.sk.flush() + except IOError: + raise closed() def startreq(status, headers, exc_info = None): if resp: