twisted :: web :: http :: HTTPChannel :: Class HTTPChannel
[hide private]

Class HTTPChannel

internet.protocol.BaseProtocol --+        
                                 |        
        internet.protocol.Protocol --+    
                                     |    
   protocols.basic._PauseableMixin --+    
                                     |    
          protocols.basic.LineReceiver --+
                                         |
       protocols.policies.TimeoutMixin --+
                                         |
                                        HTTPChannel
Known Subclasses:

A receiver for HTTP requests.

Nested Classes [hide private]
  requestFactory
A HTTP request.
Instance Methods [hide private]
 
__init__(self)
 
_finishRequestBody(self, data)
 
allContentReceived(self)
 
allHeadersReceived(self)
bool
checkPersistence(self, request, version)
Check if the channel should close or not.
 
connectionLost(self, reason)
Called when the connection is shut down.
 
connectionMade(self)
Called when a connection is made.
 
headerReceived(self, line)
Do pre-processing (for content-length) and store this header away.
 
lineReceived(self, line)
Override this for when each line is received.
 
rawDataReceived(self, data)
Override this for when raw data is received.
 
requestDone(self, request)
Called by first request in queue when it is done.
 
timeoutConnection(self)
Called when the connection times out.

Inherited from protocols.basic.LineReceiver: clearLineBuffer, dataReceived, lineLengthExceeded, sendLine, setLineMode, setRawMode

Inherited from internet.protocol.Protocol: __provides__, logPrefix

Inherited from internet.protocol.BaseProtocol: __providedBy__, makeConnection

Inherited from protocols.basic._PauseableMixin: pauseProducing, resumeProducing, stopProducing

Inherited from protocols.policies.TimeoutMixin: callLater, resetTimeout, setTimeout

Class Variables [hide private]
  __content = None
hash(x)
  __first_line = 1
hash(x)
  __header = ''
  _receivedHeaderCount = 0
  _savedTimeOut = None
hash(x)
  length = 0
  maxHeaders = 500
  persistent = 1
hash(x)

Inherited from protocols.basic.LineReceiver: MAX_LENGTH, delimiter, line_mode

Inherited from internet.protocol.Protocol: __implemented__

Inherited from internet.protocol.BaseProtocol: connected, transport

Inherited from protocols.basic._PauseableMixin: paused

Inherited from protocols.policies.TimeoutMixin: timeOut

Instance Variables [hide private]
  _transferDecoder
None or an instance of _ChunkedTransferDecoder if the request body uses the chunked Transfer-Encoding.
Method Details [hide private]

checkPersistence(self, request, version)

 

Check if the channel should close or not.

Parameters:
  • request - The request most recently received over this channel against which checks will be made to determine if this connection can remain open after a matching response is returned.
  • version (str) - The version of the request.
Returns: bool
A flag which, if True, indicates that this connection may remain open to receive another request; if False, the connection must be closed in order to indicate the completion of the response to request.

connectionLost(self, reason)

 

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

Overrides: internet.protocol.Protocol.connectionLost
(inherited documentation)

connectionMade(self)

 

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.

Overrides: internet.protocol.BaseProtocol.connectionMade
(inherited documentation)

headerReceived(self, line)

 

Do pre-processing (for content-length) and store this header away. Enforce the per-request header limit.

Parameters:
  • line (str) - A line from the header section of a request, excluding the line delimiter.

lineReceived(self, line)

 

Override this for when each line is received.

Parameters:
  • line - The line which was received with the delimiter removed.
Overrides: protocols.basic.LineReceiver.lineReceived
(inherited documentation)

rawDataReceived(self, data)

 

Override this for when raw data is received.

Overrides: protocols.basic.LineReceiver.rawDataReceived
(inherited documentation)

timeoutConnection(self)

 

Called when the connection times out.

Override to define behavior other than dropping the connection.

Overrides: protocols.policies.TimeoutMixin.timeoutConnection
(inherited documentation)