t.w.c.h.HTTPChannel(basic.LineReceiver, policies.TimeoutMixin, object) : class documentation

Part of twisted.web2.channel.http View Source View In Hierarchy

Implements interfaces: twisted.internet.interfaces.IHalfCloseableProtocol

A receiver for HTTP requests. Handles splitting up the connection for the multiple HTTPChannelRequests that may be in progress on this channel.
Instance VariablestimeOutnumber of seconds to wait before terminating an idle connection.
maxPipelinenumber of outstanding in-progress requests to allow before pausing the input.
maxHeaderLengthnumber of bytes of header to accept from the client.
Method __init__ Undocumented
Method connectionMade Called when a connection is made.
Method lineReceived Override this for when each line is received.
Method lineLengthExceeded Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
Method rawDataReceived Override this for when raw data is received.
Method requestReadFinished Undocumented
Method setReadPersistent Undocumented
Method dropQueuedRequests Called when a response is written that forces a connection close.
Method isLastRequest Undocumented
Method requestWriteFinished Called by first request in queue when it is done.
Method timeoutConnection Called when the connection times out. Override to define behavior other than dropping the connection.
Method lingeringClose This is a bit complicated. This process is necessary to ensure proper workingness when HTTP pipelining is in use.
Method writeConnectionLost Notification of the write connection being closed.
Method readConnectionLost Read connection lost
Method connectionLost Called when the connection is shut down.
Method _callLater Undocumented
Method _startNextRequest Undocumented
Method _lingerClose Undocumented

Inherited from LineReceiver:

Method clearLineBuffer Clear buffered data.
Method dataReceived Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
Method setLineMode Sets the line-mode of this receiver.
Method setRawMode Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
Method sendLine Sends a line to the other end of the connection.

Inherited from BaseProtocol (via LineReceiver, Protocol):

Method makeConnection Make a connection to a transport and a server.

Inherited from _PauseableMixin (via LineReceiver):

Method pauseProducing Undocumented
Method resumeProducing Undocumented
Method stopProducing Undocumented

Inherited from TimeoutMixin:

Method callLater Undocumented
Method resetTimeout Reset the timeout count down
Method setTimeout Change the timeout period
Method __timedOut Undocumented
def _callLater(self, secs, fun): (source)
Undocumented
def __init__(self): (source)
Undocumented
def connectionMade(self): (source)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
def lineReceived(self, line): (source)
Override this for when each line is received.
def lineLengthExceeded(self, line): (source)

Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.

The argument 'line' contains the remainder of the buffer, starting with (at least some part) of the line which is too long. This may be more than one line, or may be only the initial portion of the line.
def rawDataReceived(self, data): (source)
Override this for when raw data is received.
def requestReadFinished(self, request): (source)
Undocumented
def _startNextRequest(self): (source)
Undocumented
def setReadPersistent(self, persistent): (source)
Undocumented
def dropQueuedRequests(self): (source)
Called when a response is written that forces a connection close.
def isLastRequest(self, request): (source)
Undocumented
def requestWriteFinished(self, request): (source)
Called by first request in queue when it is done.
def timeoutConnection(self): (source)
Called when the connection times out. Override to define behavior other than dropping the connection.
def lingeringClose(self): (source)

This is a bit complicated. This process is necessary to ensure proper workingness when HTTP pipelining is in use.

Here is what it wants to do:
  1. Finish writing any buffered data, then close our write side. While doing so, read and discard any incoming data.
  2. When that happens (writeConnectionLost called), wait up to 20 seconds for the remote end to close their write side (our read side).
    • If they do (readConnectionLost called), close the socket, and cancel the timeout.
    • If that doesn't happen, the timer fires, and makes the socket close anyways.
def writeConnectionLost(self): (source)

Notification of the write connection being closed.

This will never be called for TCP connections as TCP does not support notification of this type of half-close.
def _lingerClose(self): (source)
Undocumented
def readConnectionLost(self): (source)
Read connection lost
def connectionLost(self, reason): (source)

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.
Parametersreason (type: twisted.python.failure.Failure )
API Documentation for Twisted, generated by pydoctor at 2011-10-27 15:57:47.