#include <connectionhttpproxy.h>
Inherits ConnectionBase, and ConnectionDataHandler.
Inheritance diagram for ConnectionHTTPProxy:

Public Member Functions | |
| ConnectionHTTPProxy (ConnectionBase *connection, const LogSink &logInstance, const std::string &server, int port=-1) | |
| ConnectionHTTPProxy (ConnectionDataHandler *cdh, ConnectionBase *connection, const LogSink &logInstance, const std::string &server, int port=-1) | |
| virtual | ~ConnectionHTTPProxy () |
| virtual ConnectionError | connect () |
| virtual ConnectionError | recv (int timeout=-1) |
| virtual bool | send (const std::string &data) |
| virtual ConnectionError | receive () |
| virtual void | disconnect () |
| virtual void | cleanup () |
| virtual void | getStatistics (long int &totalIn, long int &totalOut) |
| virtual void | handleReceivedData (const ConnectionBase *connection, const std::string &data) |
| virtual void | handleConnect (const ConnectionBase *connection) |
| virtual void | handleDisconnect (const ConnectionBase *connection, ConnectionError reason) |
| virtual ConnectionBase * | newInstance () const |
| void | setServer (const std::string &host, int port=-1) |
| void | setProxyAuth (const std::string &user, const std::string &password) |
| void | setConnectionImpl (ConnectionBase *connection) |
| void | setHTTP11 (bool http11) |
Usage:
Client* c = new Client( ... ); ConnectionTCPClient* conn0 = new ConnectionTCPClient( c->logInstance(), proxyHost, proxyPort ); ConnectionHTTPProxy* conn1 = new ConnectionHTTPProxy( c, conn0, c->logInstance(), xmppHost, xmppPort ); c->setConnectionImpl( conn1 );
Make sure to pass the proxy host/port to the transport connection (ConnectionTCPClient in this case), and the XMPP host/port to the proxy connection.
ConnectionHTTPProxy uses the CONNECT method to pass through the proxy. If your proxy does not allow this kind of connections, or if it kills connections after some time, you may want to use ConnectionBOSH instead or in addition.
The reason why ConnectionHTTPProxy doesn't manage its own ConnectionTCPClient is that it allows it to be used with other transports (like IPv6 or chained SOCKS5/HTTP proxies).
Definition at line 53 of file connectionhttpproxy.h.
|
||||||||||||||||||||
|
Constructs a new ConnectionHTTPProxy object.
Definition at line 29 of file connectionhttpproxy.cpp. |
|
||||||||||||||||||||||||
|
Constructs a new ConnectionHTTPProxy object.
Definition at line 43 of file connectionhttpproxy.cpp. |
|
|
Virtual destructor Definition at line 58 of file connectionhttpproxy.cpp. |
|
|
This function is called after a disconnect to clean up internal state. It is also called by ConnectionBase's destructor. Reimplemented from ConnectionBase. Definition at line 110 of file connectionhttpproxy.cpp. |
|
|
Used to initiate the connection.
Implements ConnectionBase. Definition at line 77 of file connectionhttpproxy.cpp. |
|
|
Disconnects an established connection. NOOP if no active connection exists. Implements ConnectionBase. Definition at line 88 of file connectionhttpproxy.cpp. |
|
||||||||||||
|
Returns current connection statistics.
Implements ConnectionBase. Definition at line 118 of file connectionhttpproxy.cpp. |
|
|
This function is called when e.g. the raw TCP connection was established.
Implements ConnectionDataHandler. Definition at line 161 of file connectionhttpproxy.cpp. |
|
||||||||||||
|
This connection is called when e.g. the raw TCP connection was closed.
Implements ConnectionDataHandler. Definition at line 205 of file connectionhttpproxy.cpp. |
|
||||||||||||
|
This function is called for received from the underlying transport.
Implements ConnectionDataHandler. Definition at line 126 of file connectionhttpproxy.cpp. |
|
|
This function returns a new instance of the current ConnectionBase-derived object. The idea is to be able to 'clone' ConnectionBase-derived objects without knowing of what type they are exactly.
Implements ConnectionBase. Definition at line 63 of file connectionhttpproxy.cpp. |
|
|
Use this function to put the connection into 'receive mode', i.e. this function returns only when the connection is terminated.
Implements ConnectionBase. Definition at line 100 of file connectionhttpproxy.cpp. |
|
|
Use this periodically to receive data from the socket.
Implements ConnectionBase. Definition at line 95 of file connectionhttpproxy.cpp. |
|
|
Use this function to send a string of data over the wire. The function returns only after all data has been sent.
Implements ConnectionBase. Definition at line 105 of file connectionhttpproxy.cpp. |
|
|
Sets the underlying transport connection. A possibly existing connection will be deleted.
Definition at line 69 of file connectionhttpproxy.cpp. |
|
|
Switches usage of HTTP/1.1 on or off.
Definition at line 153 of file connectionhttpproxy.h. |
|
||||||||||||
|
Sets proxy authorization credentials.
Definition at line 139 of file connectionhttpproxy.h. |
|
||||||||||||
|
Sets the XMPP server to proxy to.
Reimplemented from ConnectionBase. Definition at line 131 of file connectionhttpproxy.h. |
1.4.1