'Do various things to conform to the CGI specification.
I will set up the usual slew of environment variables, then spin off a
process.
@type request: L{twisted.web.http.Request}
@param request: An HTTP request.'

def render(self, request):

    scriptName = ('/' + '/'.join(request.prepath))
    serverName = request.getRequestHostname().split(':')[0]
    env = {'SERVER_SOFTWARE': server.version, 'SERVER_NAME': serverName, 'GATEWAY_INTERFACE': 'CGI/1.1', 'SERVER_PROTOCOL': request.clientproto, 'SERVER_PORT': str(request.getHost().port), 'REQUEST_METHOD': request.method, 'SCRIPT_NAME': scriptName, 'SCRIPT_FILENAME': self.filename, 'REQUEST_URI': request.uri}
    ip = request.getClientIP()
    if (ip is not None):
        env['REMOTE_ADDR'] = ip
    pp = request.postpath
    if pp:
        env['PATH_INFO'] = ('/' + '/'.join(pp))
    if hasattr(request, 'content'):
        request.content.seek(0, 2)
        length = request.content.tell()
        request.content.seek(0, 0)
        env['CONTENT_LENGTH'] = str(length)
    try:
        qindex = request.uri.index('?')
    except ValueError:
        env['QUERY_STRING'] = ''
        qargs = []
    else:
        qs = env['QUERY_STRING'] = request.uri[(qindex + 1):]
        if ('=' in qs):
            qargs = []
        else:
            qargs = [urllib.unquote(x) for x in qs.split('+')]
    for (title, header) in request.getAllHeaders().items():
        envname = title.replace('-', '_').upper()
        if (title not in ('content-type', 'content-length', 'proxy')):
            envname = ('HTTP_' + envname)
        env[envname] = header
    for (key, value) in os.environ.items():
        if (key not in env):
            env[key] = value
    self.runProcess(env, request, qargs)
    return server.NOT_DONE_YET
