From: Fredrik Tolf Date: Mon, 6 Jan 2014 02:53:14 +0000 (+0100) Subject: python: Keep a copy of the real socket for Python2 as in Python3. X-Git-Url: http://www.dolda2000.com/gitweb/?p=ashd.git;a=commitdiff_plain;h=313bd505f6aa74c239154d7899bcc81a4a06b956 python: Keep a copy of the real socket for Python2 as in Python3. --- diff --git a/python/ashd/proto.py b/python/ashd/proto.py index 8dc5ecd..e18023d 100644 --- a/python/ashd/proto.py +++ b/python/ashd/proto.py @@ -46,12 +46,14 @@ class req(object): self.ver = ver self.rest = rest self.headers = headers - self.sk = socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM).makefile('r+') + self.bsk = socket.fromfd(fd, socket.AF_UNIX, socket.SOCK_STREAM) + self.sk = self.bsk.makefile('r+') os.close(fd) def close(self): "Close this request's response socket." self.sk.close() + self.bsk.close() def __getitem__(self, header): """Find a HTTP header case-insensitively. For example, @@ -79,7 +81,7 @@ class req(object): """Creates a duplicate of this request, referring to a duplicate of the response socket. """ - return req(self.method, self.url, self.ver, self.rest, self.headers, os.dup(self.sk.fileno())) + return req(self.method, self.url, self.ver, self.rest, self.headers, os.dup(self.bsk.fileno())) def match(self, match): """If the `match' argument matches exactly the leading part of