Part of twisted.web._newclient View Source View In Hierarchy
HTTP11ClientProtocol
is an implementation of the HTTP 1.1 client protocol. It supports as few
features as possible.
Instance Variables | _parser | After a request is issued, the HTTPClientParser
to which received data making up the response to that request is
delivered.
|
_finishedRequest | After a request is issued, the Deferred which
will fire when a Response object
corresponding to that request is available. This allows HTTP11ClientProtocol
to fail the request if there is a connection or parsing problem.
| |
_currentRequest | After a request is issued, the Request
instance used to make that request. This allows HTTP11ClientProtocol
to stop request generation if necessary (for example, if the connection is
lost).
| |
_transportProxy | After a request is issued, the TransportProxyProducer
to which _parser is connected. This allows
_parser to pause and resume the transport in a way which HTTP11ClientProtocol
can exert some control over.
| |
_responseDeferred | After a request is issued, the Deferred from
_parser which will fire with a Response when one
has been received. This is eventually chained with
_finishedRequest , but only in certain cases to avoid double
firing that Deferred.
| |
_state | Indicates what state this HTTP11ClientProtocol
instance is in with respect to transmission of a request and reception of a
response. This may be one of the following strings:
|
Method | request | Issue request over self.transport and return a
Deferred
which will fire with a Response instance
or an error.
|
Method | dataReceived | Handle some stuff from some place. |
Method | connectionLost | The underlying transport went away. If appropriate, notify the parser object. |
Method | abort | Close the connection and cause all outstanding request
Deferred s
to fire with an error.
|
Method | _finishResponse | Called by an HTTPClientParser
to indicate that it has parsed a complete response.
|
Method | _disconnectParser | If there is still a parser, call its connectionLost method
with the given reason. If there is not, do nothing.
|
Method | _giveUp | Lose the underlying connection and disconnect the parser with the given
Failure .
|
Method | _connectionLost_QUIESCENT | Nothing is currently happening. Move to the
'CONNECTION_LOST' state but otherwise do nothing.
|
Method | _connectionLost_GENERATION_FAILED | The connection was in an inconsistent state. Move to the
'CONNECTION_LOST' state but otherwise do nothing.
|
Method | _connectionLost_TRANSMITTING | Fail the Deferred for
the current request, notify the request object that it does not need to
continue transmitting itself, and move to the
'CONNECTION_LOST' state.
|
Method | _connectionLost_WAITING | No summary |
Method | _connectionLost_ABORTING | Disconnect the response parser with a ConnectionAborted
failure, and move to the 'CONNECTION_LOST' state.
|
Inherited from BaseProtocol (via Protocol):
Method | makeConnection | Make a connection to a transport and a server. |
Method | connectionMade | Called when a connection is made. |
request
over self.transport
and return a
Deferred
which will fire with a Response
instance
or an error.
Parameters | request | The object defining the parameters of the request to issue.
(type: Request
) |
Returns | The deferred may errback with RequestGenerationFailed
if the request was not fully written to the transport due to a local error.
It may errback with RequestTransmissionFailed
if it was not fully written to the transport due to a network error. It
may errback with ResponseFailed
if the request was sent (not necessarily received) but some or all of the
response was lost. It may errback with RequestNotSent
if it is not possible to send any more requests using this HTTP11ClientProtocol .
(type: Deferred
) |
HTTPClientParser
to indicate that it has parsed a complete response.
Parameters | rest | A str giving any trailing bytes which were given to the HTTPClientParser
which were not part of the response it was parsing.
|
connectionLost
method
with the given reason. If there is not, do nothing.
Parameters | reason | (type: Failure
) |
Lose the underlying connection and disconnect the parser with the given
Failure
.
'CONNECTION_LOST'
state but otherwise do nothing.
'CONNECTION_LOST'
state but otherwise do nothing.
Deferred
for
the current request, notify the request object that it does not need to
continue transmitting itself, and move to the
'CONNECTION_LOST'
state.
connectionLost
method, or to fail a request Deferred
) and
move to the 'CONNECTION_LOST'
state.
ConnectionAborted
failure, and move to the 'CONNECTION_LOST'
state.