class twisted.web._newclient.HTTPClientParser(HTTPParser): (source)
An HTTP parser which only handles HTTP responses.
Instance Variable | request | The request with which the expected response is associated. |
Instance Variable | NO_BODY_CODES | A set of response codes which MUST NOT have a body. |
Instance Variable | finisher | A callable to invoke when this response is fully parsed. |
Class Variable | bodyDecoder | Undocumented |
Method | __init__ | Undocumented |
Method | dataReceived | Override so that we know if any response has been received. |
Method | parseVersion | Parse version strings of the form Protocol '/' Major '.' Minor. E.g. b'HTTP/1.1'. Returns (protocol, major, minor). Will raise ValueError on bad syntax. |
Method | statusReceived | Parse the status line into its components and create a response object to keep track of this response's state. |
Instance Variable | response | Undocumented |
Instance Variable | state | Undocumented |
Method | isConnectionControlHeader | Content-Length in the response to a HEAD request is an entity header, not a connection control header. |
Method | allHeadersReceived | Figure out how long the response body is going to be by examining headers and stuff. |
Method | connectionLost | Called when the connection is shut down. |
Instance Variable | _responseDeferred | A Deferred which will be called back with the response when all headers in the response have been received. Thereafter, None . |
Instance Variable | _everReceivedData | True if any bytes have been received. |
Class Variable | _transferDecoders | Undocumented |
Class Variable | _log | Undocumented |
Method | _finished | Called to indicate that an entire response has been received. No more bytes will be interpreted by this HTTPClientParser . Extra bytes are passed up and the state of this HTTPClientParser is set to DONE. |
Inherited from HTTPParser:
Instance Variable | headers | All of the non-connection control message headers yet received. |
Class Variable | delimiter | Undocumented |
Class Variable | CONNECTION_CONTROL_HEADERS | Undocumented |
Method | connectionMade | Called when a connection is made. |
Instance Variable | connHeaders | Undocumented |
Method | switchToBodyMode | Switch to body parsing mode - interpret any more bytes delivered as part of the message body and deliver them to the given decoder. |
Method | lineReceived | Handle one line from a response. |
Method | rawDataReceived | Pass data from the message body to the body decoder object. |
Method | headerReceived | Store the given header in self.headers . |
Instance Variable | _partialHeader | None or a list of the lines of a multiline header while that header is being received. |
Inherited from LineReceiver (via HTTPParser):
Class Variable | MAX_LENGTH | The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384. |
Instance Variable | line_mode | Undocumented |
Method | clearLineBuffer | Clear buffered data. |
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. |
Method | lineLengthExceeded | Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way. |
Instance Variable | _buffer | Undocumented |
Instance Variable | _busyReceiving | Undocumented |
Inherited from Protocol (via HTTPParser, LineReceiver):
Class Variable | factory | Undocumented |
Method | logPrefix | Return a prefix matching the class name, to identify log messages related to this protocol instance. |
Inherited from BaseProtocol (via HTTPParser, LineReceiver, Protocol):
Instance Variable | connected | Undocumented |
Instance Variable | transport | Undocumented |
Method | makeConnection | Make a connection to a transport and a server. |
Inherited from _PauseableMixin (via HTTPParser, LineReceiver):
Instance Variable | paused | Undocumented |
Method | pauseProducing | Undocumented |
Method | resumeProducing | Undocumented |
Method | stopProducing | Undocumented |
Parse version strings of the form Protocol '/' Major '.' Minor. E.g. b'HTTP/1.1'. Returns (protocol, major, minor). Will raise ValueError on bad syntax.
Parse the status line into its components and create a response object to keep track of this response's state.
Called to indicate that an entire response has been received. No more bytes will be interpreted by this HTTPClientParser
. Extra bytes are passed up and the state of this HTTPClientParser
is set to DONE.
Parameters | rest | A bytes giving any extra bytes delivered to this HTTPClientParser which are not part of the response being parsed. |
Content-Length in the response to a HEAD request is an entity header, not a connection control header.
Figure out how long the response body is going to be by examining headers and stuff.
Called when the connection is shut down.
Clear any circular references here, and any external references to this Protocol. The connection has been closed.
Parameters | reason | Undocumented (type: twisted.python.failure.Failure ) |