Ejemplo n.º 1
0
    def __init__(self,
                 application,
                 environ=None,
                 bindAddress=None,
                 umask=None,
                 multiplexed=False,
                 debug=False,
                 roles=(FCGI_RESPONDER, ),
                 forceCGI=False,
                 **kw):
        """
        environ, if present, must be a dictionary-like object. Its
        contents will be copied into application's environ. Useful
        for passing application-specific variables.

        bindAddress, if present, must either be a string or a 2-tuple. If
        present, run() will open its own listening socket. You would use
        this if you wanted to run your application as an 'external' FastCGI
        app. (i.e. the webserver would no longer be responsible for starting
        your app) If a string, it will be interpreted as a filename and a UNIX
        socket will be opened. If a tuple, the first element, a string,
        is the interface name/IP to bind to, and the second element (an int)
        is the port number.
        """
        BaseFCGIServer.__init__(self,
                                application,
                                environ=environ,
                                multithreaded=False,
                                multiprocess=False,
                                bindAddress=bindAddress,
                                umask=umask,
                                multiplexed=multiplexed,
                                debug=debug,
                                roles=roles,
                                forceCGI=forceCGI)
        for key in ('jobClass', 'jobArgs'):
            if kw.has_key(key):
                del kw[key]
        SingleServer.__init__(self,
                              jobClass=self._connectionClass,
                              jobArgs=(self, ),
                              **kw)
        self.capability = {
            FCGI_MAX_CONNS: 1,
            FCGI_MAX_REQS: 1,
            FCGI_MPXS_CONNS: 0
        }
Ejemplo n.º 2
0
    def __init__(self, application, environ=None,
                 bindAddress=None, umask=None, multiplexed=False,
                 debug=True, roles=(FCGI_RESPONDER,), forceCGI=False, **kw):
        """
        environ, if present, must be a dictionary-like object. Its
        contents will be copied into application's environ. Useful
        for passing application-specific variables.

        bindAddress, if present, must either be a string or a 2-tuple. If
        present, run() will open its own listening socket. You would use
        this if you wanted to run your application as an 'external' FastCGI
        app. (i.e. the webserver would no longer be responsible for starting
        your app) If a string, it will be interpreted as a filename and a UNIX
        socket will be opened. If a tuple, the first element, a string,
        is the interface name/IP to bind to, and the second element (an int)
        is the port number.
        """
        BaseFCGIServer.__init__(self, application,
                                environ=environ,
                                multithreaded=False,
                                multiprocess=False,
                                bindAddress=bindAddress,
                                umask=umask,
                                multiplexed=multiplexed,
                                debug=debug,
                                roles=roles,
                                forceCGI=forceCGI)
        for key in ('jobClass', 'jobArgs'):
            if key in kw:
                del kw[key]
        SingleServer.__init__(self, jobClass=self._connectionClass,
                              jobArgs=(self,), **kw)
        self.capability = {
            FCGI_MAX_CONNS: 1,
            FCGI_MAX_REQS: 1,
            FCGI_MPXS_CONNS: 0
            }
Ejemplo n.º 3
0
    def run(self):
        """
        The main loop. Exits on SIGHUP, SIGINT, SIGTERM. Returns True if
        SIGHUP was received, False otherwise.
        """
        self._web_server_addrs = os.environ.get('FCGI_WEB_SERVER_ADDRS')
        if self._web_server_addrs is not None:
            self._web_server_addrs = [x.strip() for x in self._web_server_addrs.split(',')]

        sock = self._setupSocket()

        ret = SingleServer.run(self, sock)

        self._cleanupSocket(sock)

        return ret
Ejemplo n.º 4
0
    def run(self):
        """
        The main loop. Exits on SIGHUP, SIGINT, SIGTERM. Returns True if
        SIGHUP was received, False otherwise.
        """
        self._web_server_addrs = os.environ.get('FCGI_WEB_SERVER_ADDRS')
        if self._web_server_addrs is not None:
            self._web_server_addrs = map(lambda x: x.strip(),
                                         self._web_server_addrs.split(','))

        sock = self._setupSocket()

        ret = SingleServer.run(self, sock)

        self._cleanupSocket(sock)

        return ret