summaryrefslogtreecommitdiff
path: root/wsgitools/scgi/forkpool.py
diff options
context:
space:
mode:
Diffstat (limited to 'wsgitools/scgi/forkpool.py')
-rw-r--r--wsgitools/scgi/forkpool.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py
index 361fb40..f3990cb 100644
--- a/wsgitools/scgi/forkpool.py
+++ b/wsgitools/scgi/forkpool.py
@@ -414,9 +414,9 @@ class SCGIServer(object):
if not b':' in data:
con.close()
return
- length, data = data.split(b':', 1)
+ lengthb, data = data.split(b':', 1)
try:
- length = int(length)
+ length = int(lengthb)
except ValueError: # clear protocol violation
con.close()
return
@@ -433,17 +433,17 @@ class SCGIServer(object):
data += t
# netstrings!
- data = data.split(b'\0')
+ strings = data.split(b'\0')
# the byte beyond has to be a ','.
# and the number of netstrings excluding the final ',' has to be even
- if data.pop() != b',' or len(data) % 2 != 0:
+ if strings.pop() != b',' or len(strings) % 2 != 0:
con.close()
return
environ = self.config.copy()
- while data:
- key = bytes2str(data.pop(0))
- value = bytes2str(data.pop(0))
+ while strings:
+ key = bytes2str(strings.pop(0))
+ value = bytes2str(strings.pop(0))
environ[key] = value
# elements:
@@ -480,8 +480,8 @@ class SCGIServer(object):
assert all(isinstance(k, str) and isinstance(v, str)
for (k, v) in headers)
assert not response_head[0] # unset or not sent
- headers = "".join(map("%s: %s\r\n".__mod__, headers))
- full_header = "Status: %s\r\n%s\r\n" % (status, headers)
+ full_header = "Status: %s\r\n%s\r\n" % \
+ (status, "".join(map("%s: %s\r\n".__mod__, headers)))
response_head[1] = str2bytes(full_header)
response_head[0] = False # set but nothing sent
return dumbsend