diff options
author | Helmut Grohne <helmut@subdivi.de> | 2007-04-15 18:11:55 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2007-04-15 18:11:55 +0200 |
commit | 515f339ae578b9659777ef940728b23b67ce26e0 (patch) | |
tree | 5e4c6530d17fb483e38caed195ff5f9516da1227 | |
parent | 21d54fd261b972bbdb7f4eea267f4696c6958600 (diff) | |
download | wsgitools-515f339ae578b9659777ef940728b23b67ce26e0.tar.gz |
longer variable names are a good thing(tm)
-rw-r--r-- | wsgitools/scgi.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/wsgitools/scgi.py b/wsgitools/scgi.py index e5b7dfc..477acf9 100644 --- a/wsgitools/scgi.py +++ b/wsgitools/scgi.py @@ -71,15 +71,15 @@ class SCGIConnection(asyncore.dispatcher): self.inbuff += data if self.state == SCGIConnection.NEW: if ':' in self.inbuff: - l, self.inbuff = self.inbuff.split(':', 1) - if not l.isdigit(): + reqlen, self.inbuff = self.inbuff.split(':', 1) + if not reqlen.isdigit(): self.close() return # invalid request format - l = long(l) - if l > self.MAX_REQUEST_SIZE: + reqlen = long(reqlen) + if reqlen > self.MAX_REQUEST_SIZE: self.close() return # request too long - self.reqlen = l + self.reqlen = reqlen self.state = SCGIConnection.HEADER elif len(self.inbuff) > self.MAX_REQUEST_SIZE: self.close() @@ -90,9 +90,9 @@ class SCGIConnection(asyncore.dispatcher): remainder = self.inbuff[self.reqlen:] while buff.count('\0') >= 2: - k, v, buff = buff.split('\0', 2) - self.environ[k] = v - self.reqlen -= len(k) + len(v) + 2 + key, value, buff = buff.split('\0', 2) + self.environ[key] = value + self.reqlen -= len(key) + len(value) + 2 self.inbuff = buff + remainder @@ -154,13 +154,13 @@ class SCGIConnection(asyncore.dispatcher): self.close() return try: - n = self.send(self.outbuff[:self.BLOCK_SIZE]) + sentbytes = self.send(self.outbuff[:self.BLOCK_SIZE]) except socket.error: if hasattr(self.wsgihandler, "close"): self.wsgihandler.close() self.close() return - self.outbuff = self.outbuff[n:] + self.outbuff = self.outbuff[sentbytes:] def handle_close(self): """asyncore interface""" @@ -178,9 +178,10 @@ class SCGIServer(asyncore.dispatcher): self.listen(5) def handle_accept(self): - r = self.accept() - if r is not None: - conn, addr = r + """asyncore interface""" + ret = self.accept() + if ret is not None: + conn, addr = ret SCGIConnection(self, conn, addr) def run(self): |