class documentation

class ReverseProxy(HTTPChannel): (source)

View In Hierarchy

Implements a simple reverse proxy.

For details of usage, see the file examples/reverse-proxy.py.

Inherited from HTTPChannel:

Method __init__ Undocumented
Method all​Content​Received Undocumented
Method all​Headers​Received Undocumented
Method check​Persistence Check if the channel should close or not.
Method connection​Lost Called when the connection is shut down.
Method connection​Made Called when a connection is made.
Method data​Received Data was received from the network. Process it.
Method force​Abort​Client No summary
Method get​Host Get the local address of this connection.
Method get​Peer Get the remote address of this connection.
Method header​Received Do pre-processing (for content-length) and store this header away. Enforce the per-request header limit.
Method is​Secure Return True if this channel is using a secure transport.
Method line​Received Called for each line from request until the end of headers when it enters binary mode.
Method lose​Connection Closes the connection. Will write any data that is pending to be sent on the network, but if this response has not yet been written to the network will not write anything.
Method pause​Producing Pause producing data.
Method raw​Data​Received Override this for when raw data is received.
Method register​Producer Register to receive data from a producer.
Method request​Done Called by first request in queue when it is done.
Method resume​Producing Resume producing data.
Method stop​Producing Stop producing data.
Method timeout​Connection Called when the connection times out.
Method unregister​Producer Stop consuming data from a producer, without disconnecting.
Method write Called by Request objects to write response data.
Method write​Headers Called by Request objects to write a complete set of HTTP headers to a transport.
Method write​Sequence Write a list of strings to the HTTP response.
Instance Variable abort​Timeout The number of seconds to wait after we attempt to shut the transport down cleanly to give up and forcibly terminate it. This is only used when we time a connection out, to prevent errors causing the FD to get leaked. If this is None, we will wait forever.
Instance Variable length Undocumented
Instance Variable MAX​_LENGTH Maximum length for initial request line and each line from the header.
Instance Variable max​Headers Maximum number of headers allowed per request.
Instance Variable persistent Undocumented
Instance Variable requests Undocumented
Instance Variable total​Headers​Size Maximum bytes for request line plus all headers from the request.
Method _finish​Request​Body Undocumented
Method _maybe​Choose​Transfer​Decoder If the provided header is content-length or transfer-encoding, choose the appropriate decoder if any.
Method _respond​To​Bad​Request​And​Disconnect This is a quick and dirty way of responding to bad requests.
Method _send100​Continue Sends a 100 Continue response, used to signal to clients that further processing will be performed.
Class Variable __content Undocumented
Class Variable __header Undocumented
Class Variable _log Undocumented
Instance Variable __first​_line Undocumented
Instance Variable _aborting​Call The twisted.internet.base.DelayedCall that will be used to forcibly close the transport if it doesn't close cleanly.
Instance Variable _command Undocumented
Instance Variable _data​Buffer Any data that has been received from the connection while processing an outstanding request.
Instance Variable _handling​Request Whether a request is currently being processed.
Instance Variable _network​Producer Either the transport, if it provides interfaces.IPushProducer, or a null implementation of interfaces.IPushProducer. Used to attempt to prevent the transport from producing excess data when we're responding to a request.
Instance Variable _optimistic​Eager​Read​Size When a resource takes a long time to answer a request (via twisted.web.server.NOT_DONE_YET, hopefully one day by a Deferred), we would like to be able to let that resource know about the underlying transport disappearing as promptly as possible, via Request.notifyFinish, and therefore via self.requests[...].connectionLost() on this HTTPChannel.
Instance Variable _path Undocumented
Instance Variable _received​Header​Count Undocumented
Instance Variable _received​Header​Size Bytes received so far for the header.
Instance Variable _request​Producer If the Request object or anything it calls registers itself as an interfaces.IProducer, it will be stored here. This is used to create a producing pipeline: pause/resume producing methods will be propagated from the transport, through the HTTPChannel instance, to the c{_requestProducer}.
Instance Variable _request​Producer​Streaming A boolean that tracks whether the producer on the Request side of this channel has registered itself as a interfaces.IPushProducer or an interfaces.IPullProducer.
Instance Variable _saved​Time​Out Undocumented
Instance Variable _transfer​Decoder None or a decoder instance if the request body uses the chunked Transfer-Encoding.
Instance Variable _version Undocumented
Instance Variable _waiting​For​Transport A boolean that tracks whether the transport has asked us to stop producing. This is used to keep track of what we're waiting for: if the transport has asked us to stop producing then we don't want to unpause the transport until it asks us to produce again.

Inherited from LineReceiver (via HTTPChannel):

Method clear​Line​Buffer Clear buffered data.
Method line​Length​Exceeded Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
Method send​Line Sends a line to the other end of the connection.
Method set​Line​Mode Sets the line-mode of this receiver.
Method set​Raw​Mode Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
Class Variable delimiter The line-ending delimiter to use. By default this is b'\r\n'.
Instance Variable line​_mode Undocumented
Instance Variable _buffer Undocumented
Instance Variable _busy​Receiving Undocumented

Inherited from Protocol (via HTTPChannel, LineReceiver):

Method log​Prefix Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable factory Undocumented

Inherited from BaseProtocol (via HTTPChannel, LineReceiver, Protocol):

Method make​Connection Make a connection to a transport and a server.
Instance Variable connected Undocumented
Instance Variable transport Undocumented

Inherited from _PauseableMixin (via HTTPChannel, LineReceiver):

Instance Variable paused Undocumented

Inherited from TimeoutMixin (via HTTPChannel):

Method call​Later Wrapper around reactor.callLater for test purpose.
Method reset​Timeout Reset the timeout count down.
Method set​Timeout Change the timeout period
Instance Variable time​Out The number of seconds after which to timeout the connection.
Method __timed​Out Undocumented
Instance Variable __timeout​Call Undocumented