Disconnect HTTP client;
Set FcgidOutputBufferSize to zero if server uses mod_fcgid;
Disable mod_deflate when rendering text/html output
338276
function abort() {
		if (!headers_sent() && session_status()!=PHP_SESSION_ACTIVE)
			session_start();
		$out='';
		while (ob_get_level())
			$out=ob_get_clean().$out;
		if (!headers_sent()) {
			header('Content-Length: '.strlen($out));
			header('Connection: close');
		}
		session_commit();
		echo $out;
		flush();
		if (function_exists('fastcgi_finish_request'))
			fastcgi_finish_request();
	}
1236510
@Override
    public void flush(int requestNumber) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "flush", "" + requestNumber);

        // Locate the browser session to use.
        BrowserSession browserSession = mainConsumer.getBrowserSession();
        SIBusMessage msg = null;

        // Browse the next message and send it to the client.
        try {
            msg = getNextMessage(browserSession, getConversation(), (short) requestNumber);
            if (msg != null)
                sendMessage(msg);

            // Send a response to the browse request.
            try {
                getConversation().send(poolManager.allocate(),
                                       JFapChannelConstants.SEG_FLUSH_SESS_R,
                                       requestNumber,
                                       Conversation.PRIORITY_LOWEST,
                                       true,
                                       ThrottlingPolicy.BLOCK_THREAD,
                                       null);
            } catch (SIException e) {
                FFDCFilter.processException(e, CLASS_NAME + ".flush",
                                            CommsConstants.CATBROWSECONSUMER_FLUSH_01,
                                            this);

                SibTr.error(tc, "COMMUNICATION_ERROR_SICO2012", e);

                // Nothing else we can do at this point as the comms exception suggests that the
                // conversation is dead, anyway.
            }

        } catch (OperationFailedException e) {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                SibTr.exception(this, tc, e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "flush");
    }
1122669
function truncateLogOutput(output, maxLength) {
  if (typeof(maxLength) === 'undefined') maxLength = maxOutputLength;
  if (! output) return(output);

  if (typeof(output) !== 'string') output = output.toString();
  var length = output.length;
  if ((! length) || (length < (maxLength + 3))) return(output);

  var prefix = Math.ceil((maxLength - 3)/2);
  var suffix = Math.floor((maxLength - 3)/2);
  return(output.slice(0, prefix)+ '...' +
    output.slice(length-suffix));
}
747198
def output(self, stream, disabletransferencoding = None):
        
        if self._sendHeaders:
            raise HttpProtocolException('Cannot modify response, headers already sent')
        self.outputstream = stream
        try:
            content_length = len(stream)
        except Exception:
            pass
        else:
            self.header(b'Content-Length', str(content_length).encode('ascii'))
        if disabletransferencoding is not None:
            self.disabledeflate = disabletransferencoding
        self._startResponse()
943161
function _stream_truncate($new_size)
    {
        if (!$this->sftp->truncate($this->path, $new_size)) {
            return false;
        }

        $this->eof = false;
        $this->size = $new_size;

        return true;
    }
990068
def ungrab_server(self, onerror = None):
        """"""
        request.UngrabServer(display = self.display,
                             onerror = onerror)
903559
@Deprecated
    public void shutdownOutput() {
        LOG.trace("enter HttpConnection.shutdownOutput()");

        try {
            socket.shutdownOutput();
        } catch (Exception ex) {
            LOG.debug("Unexpected Exception caught", ex);
            // Ignore, and hope everything goes right
        }
        // close output stream?
    }
208916
def on_disconnect(self):
        ""
        if self._sock is not None:
            self._sock.close()
            self._sock = None
        if self._buffer is not None:
            self._buffer.close()
            self._buffer = None
        self.encoding = None
1100384
def htmlNodeDumpOutput(self, buf, cur, encoding):
        
        if buf is None: buf__o = None
        else: buf__o = buf._o
        if cur is None: cur__o = None
        else: cur__o = cur._o
        libxml2mod.htmlNodeDumpOutput(buf__o, self._o, cur__o, encoding)
505106
function onDisconnect() {
	var rids = Object.keys( cache ),
		len = rids.length,
		i;

	// TODO: log
	console.log( process.pid, 'disconnected' );

	// Abort any pending requests...
	for ( i = 0; i < len; i++ ) {
		cache[ rids[i] ].abort();

		// TODO: log
		console.log( process.pid, 'aborting request: ', rids[ i ] );
	}
}
985916
def _abort(self) -> None:
        """"""
        self.client_terminated = True
        self.server_terminated = True
        if self.stream is not None:
            self.stream.close()  # forcibly tear down the connection
        self.close()
1337794
def _flushBuffer(self, request):
        ''''''
        assert request is self.requestSession.request
        self.requestSession.writeData(self.buffer)
        self.buffer = []
786600
private void dumpJmfBuffer(IncidentStream is, byte[] frame, int offset, int length) {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dumpJmfBuffer");

    if (frame != null) {
      // If the length passed in is 0 we probably have rubbish in both the length
      // and the offset so display the entire buffer (or at least the first 4k)
      if (length == 0) {
        is.writeLine("Request to dump offset=" + offset + " length=" + length + " implies bad data so dumping buffer from offset 0.","");
        offset = 0;
        length = frame.length;
      }
      // otherwise ensure we can't fall off the end of the buffer
      else if ((offset + length) > frame.length) {
        length = frame.length - offset;
      }
      try {
        String buffer = SibTr.formatBytes(frame, offset, length, getDiagnosticDataLimitInt());
        is.writeLine("JMF data buffer", buffer);
      } catch (Exception e) {
        // No FFDC code needed - we are FFDCing!
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "dumpJmfBuffer failed: " + e);
      }
    } else
      is.writeLine("No JMF buffer data available", "");

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dumpJmfBuffer");
  }
1203680
def end_headers(self):
        """"""
        if self.request_version != 'HTTP/0.9':
            self._headers_buffer.append(b"\r\n")
            self.flush_headers()
395232
private function finalizeOutputBuffer()
    {
        // Clean out the output buffer to the response, and send the built-up response to the client
        if ($this->isBuffering) {
            $this->response->appendBody(ob_get_contents());
            $this->isBuffering = false;

            ob_end_clean();
        }
    }
1096158
def close_client_socket(self, config, close_fd=True):
		
		if close_fd is True:
			self.__client_socket.close()
		self.__client_socket = None
352275
public void setBufferSize(int size)
    {
        HttpOutputStream out = (HttpOutputStream)_httpResponse.getOutputStream();
        if (out.isWritten()  || _writer!=null && _writer.isWritten())
            throw new IllegalStateException("Output written");
        out.setBufferSize(size);
    }