Protocol for decoding chunked Transfer-Encoding, as defined by RFC 2616, section 3.6.1. This protocol can interpret the contents of a request or response body which uses the chunked Transfer-Encoding. It cannot interpret any of the rest of the HTTP protocol.

It may make sense for _ChunkedTransferDecoder to be an actual IProtocol implementation. Currently, the only user of this class will only ever call dataReceived on it. However, it might be an improvement if the user could connect this to a transport and deliver connection lost notification. This way, `dataCallback` becomes `self.transport.write` and perhaps `finishCallback` becomes `self.transport.loseConnection()` (although I'm not sure where the extra data goes in that case). This could also allow this object to indicate to the receiver of data that the stream was not completely received, an error case which should be noticed. -exarkun

Instance Variable dataCallback A one-argument callable which will be invoked each time application data is received.
Instance Variable finishCallback A one-argument callable which will be invoked when the terminal chunk is received. It will be invoked with all bytes which were delivered to this protocol which came after the terminal chunk.
Instance Variable length Counter keeping track of how many more bytes in a chunk there are to receive.
Instance Variable state One of 'CHUNK_LENGTH', 'CRLF', 'TRAILER', 'BODY', or 'FINISHED'. For 'CHUNK_LENGTH', data for the chunk length line is currently being read. For 'CRLF', the CR LF pair which follows each chunk is being read. For 'TRAILER', the CR LF pair which follows the terminal 0-length chunk is currently being read. For 'BODY', the contents of a chunk are being read. For 'FINISHED', the last chunk has been completely read and no more input is valid.
Method __init__ Undocumented
Method dataReceived Interpret data from a request or response body which uses the chunked Transfer-Encoding.
Method noMoreData Verify that all data has been received. If it has not been, raise _DataLoss.
Method _dataReceived_CHUNK_LENGTH Undocumented
Method _dataReceived_CRLF Undocumented
Method _dataReceived_TRAILER Undocumented
Method _dataReceived_BODY Undocumented
Method _dataReceived_FINISHED Undocumented
dataCallback =
A one-argument callable which will be invoked each time application data is received.
finishCallback =
A one-argument callable which will be invoked when the terminal chunk is received. It will be invoked with all bytes which were delivered to this protocol which came after the terminal chunk.
length =
Counter keeping track of how many more bytes in a chunk there are to receive.
state =
One of 'CHUNK_LENGTH', 'CRLF', 'TRAILER', 'BODY', or 'FINISHED'. For 'CHUNK_LENGTH', data for the chunk length line is currently being read. For 'CRLF', the CR LF pair which follows each chunk is being read. For 'TRAILER', the CR LF pair which follows the terminal 0-length chunk is currently being read. For 'BODY', the contents of a chunk are being read. For 'FINISHED', the last chunk has been completely read and no more input is valid.
def __init__(self, dataCallback, finishCallback): (source)
Undocumented
def _dataReceived_CHUNK_LENGTH(self, data): (source)
Undocumented
def _dataReceived_CRLF(self, data): (source)
Undocumented
def _dataReceived_TRAILER(self, data): (source)
Undocumented
def _dataReceived_BODY(self, data): (source)
Undocumented
def _dataReceived_FINISHED(self, data): (source)
Undocumented
def dataReceived(self, data): (source)

Interpret data from a request or response body which uses the chunked Transfer-Encoding.

def noMoreData(self): (source)

Verify that all data has been received. If it has not been, raise _DataLoss.

API Documentation for Twisted, generated by pydoctor at 2018-07-14 04:53:34.