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.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/wsgitools/scgi/forkpool.py b/wsgitools/scgi/forkpool.py
index 0393bb1..90c836a 100644
--- a/wsgitools/scgi/forkpool.py
+++ b/wsgitools/scgi/forkpool.py
@@ -167,7 +167,7 @@ class SCGIServer:
self.state = state
def __init__(self, wsgiapp, port, interface="localhost", error=sys.stderr,
- minworkers=2, maxworkers=32, maxrequests=1000):
+ minworkers=2, maxworkers=32, maxrequests=1000, config={}):
"""
@param wsgiapp: is the WSGI application to be run.
@type port: int
@@ -184,6 +184,9 @@ class SCGIServer:
@type maxrequests: int
@param maxrequests: is the number of requests a worker processes before
dying
+ @type config: {}
+ @param config: the environ dictionary is updated using these values for
+ each request.
"""
assert hasattr(error, "write")
self.wsgiapp = wsgiapp
@@ -192,6 +195,7 @@ class SCGIServer:
self.minworkers = minworkers
self.maxworkers = maxworkers
self.maxrequests = maxrequests
+ self.config = config
self.error = error
self.server = None # becomes a socket
# maps filedescriptors to WorkerStates
@@ -316,7 +320,7 @@ class SCGIServer:
con.close()
return
- environ = {}
+ environ = self.config.copy()
while data:
key = data.pop(0)
value = data.pop(0)