From c329061e49e3e62619200dd4ef61f7c096337d72 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 8 Aug 2012 08:37:51 +0200 Subject: [PATCH] python: Added some SCGI fixes apparently necessary for Jython. --- python/ashd/scgi.py | 4 +++- python3/ashd/scgi.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/python/ashd/scgi.py b/python/ashd/scgi.py index 95325f2..f7ba3a8 100644 --- a/python/ashd/scgi.py +++ b/python/ashd/scgi.py @@ -37,7 +37,8 @@ def readhead(sk): class reqthread(threading.Thread): def __init__(self, sk, handler): super(reqthread, self).__init__(name = "SCGI request handler") - self.sk = sk.dup().makefile("r+") + self.bsk = sk.dup() + self.sk = self.bsk.makefile("r+") self.handler = handler def run(self): @@ -46,6 +47,7 @@ class reqthread(threading.Thread): self.handler(head, self.sk) finally: self.sk.close() + self.bsk.close() def handlescgi(sk, handler): t = reqthread(sk, handler) diff --git a/python3/ashd/scgi.py b/python3/ashd/scgi.py index a06267f..8fa5767 100644 --- a/python3/ashd/scgi.py +++ b/python3/ashd/scgi.py @@ -37,7 +37,8 @@ def readhead(sk): class reqthread(threading.Thread): def __init__(self, sk, handler): super(reqthread, self).__init__(name = "SCGI request handler") - self.sk = sk.dup().makefile("rwb") + self.bsk = sk.dup() + self.sk = self.bsk.makefile("rwb") self.handler = handler def run(self): @@ -46,6 +47,7 @@ class reqthread(threading.Thread): self.handler(head, self.sk) finally: self.sk.close() + self.bsk.close() def handlescgi(sk, handler): t = reqthread(sk, handler) -- 2.11.0