'Set up the environment for one request'

def setup_environ(self):

    env = self.environ = self.os_environ.copy()
    self.add_cgi_vars()
    env['wsgi.input'] = self.get_stdin()
    env['wsgi.errors'] = self.get_stderr()
    env['wsgi.version'] = self.wsgi_version
    env['wsgi.run_once'] = self.wsgi_run_once
    env['wsgi.url_scheme'] = self.get_scheme()
    env['wsgi.multithread'] = self.wsgi_multithread
    env['wsgi.multiprocess'] = self.wsgi_multiprocess
    if (self.wsgi_file_wrapper is not None):
        env['wsgi.file_wrapper'] = self.wsgi_file_wrapper
    if (self.origin_server and self.server_software):
        env.setdefault('SERVER_SOFTWARE', self.server_software)
    return
