Beispiel #1
0
    def _finish(self):
        self.channel.reply_code = self.status

        DebugLogger.log('A', id(self.channel),
                        '%d %d' % (self.status, self.stdout.length))

        t = self._tempfile
        if t is not None:
            self.stdout.write((file_close_producer(t), 0))
        self._tempfile = None

        self.channel.sendStreamTerminator(FCGI_STDOUT)
        self.channel.sendEndRecord()
        self.stdout.close()
        self.stderr.close()

        if not self.channel.closed:
            self.channel.push_with_producer(
                LoggingProducer(self.channel, self.stdout.length,
                                'log_request'), 0)
        if self._shutdownRequested():
            config.ZSERVER_EXIT_CODE = self._shutdown_flag
            self.channel.push(ShutdownProducer(), 0)
            Wakeup(lambda: asyncore.close_all())
        else:
            self.channel.push(None, 0)
            Wakeup()
        self.channel = None
Beispiel #2
0
    def _finish(self):
        self.channel.reply_code = self.status

        DebugLogger.log('A', id(self.channel), '%d %d' % (
            self.status, self.stdout.length))

        t = self._tempfile
        if t is not None:
            self.stdout.write((file_close_producer(t), 0))
        self._tempfile = None

        self.channel.sendStreamTerminator(FCGI_STDOUT)
        self.channel.sendEndRecord()
        self.stdout.close()
        self.stderr.close()

        if not self.channel.closed:
            self.channel.push_with_producer(LoggingProducer(self.channel,
                                                            self.stdout.length,
                                                            'log_request'), 0)
        if self._shutdownRequested():
            config.ZSERVER_EXIT_CODE = self._shutdown_flag
            self.channel.push(ShutdownProducer(), 0)
            Wakeup(lambda: asyncore.close_all())
        else:
            self.channel.push(None, 0)
            Wakeup()
        self.channel = None
Beispiel #3
0
    def _finish(self):
        if self._retried_response:
            try:
                self._retried_response._finish()
            finally:
                self._retried_response = None
            return
        stdout = self.stdout

        t = self._tempfile
        if t is not None:
            stdout.write(file_close_producer(t), 0)
            self._tempfile = None

        stdout.finish(self)
        stdout.close()

        self.stdout = None  # need to break cycle?
        self._request = None
Beispiel #4
0
    def _finish(self):
        if self._retried_response:
            try:
                self._retried_response._finish()
            finally:
                self._retried_response = None
            return
        stdout = self.stdout

        t = self._tempfile
        if t is not None:
            stdout.write(file_close_producer(t), 0)
            self._tempfile = None

        stdout.finish(self)
        stdout.close()

        self.stdout = None  # need to break cycle?
        self._request = None