#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 (int &totalIn, 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 (ConnectionTCP 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 ConnectionTCP 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 32 of file connectionhttpproxy.cpp. |
|
||||||||||||||||||||||||
|
Constructs a new ConnectionHTTPProxy object.
Definition at line 46 of file connectionhttpproxy.cpp. |
|
|
Virtual destructor Definition at line 61 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 113 of file connectionhttpproxy.cpp. |
|
|
Used to initiate the connection.
Implements ConnectionBase. Definition at line 80 of file connectionhttpproxy.cpp. |
|
|
Disconnects an established connection. NOOP if no active connection exists. Implements ConnectionBase. Definition at line 91 of file connectionhttpproxy.cpp. |
|
||||||||||||
|
Returns current connection statistics.
Implements ConnectionBase. Definition at line 121 of file connectionhttpproxy.cpp. |
|
|
This function is called when e.g. the raw TCP connection was established.
Implements ConnectionDataHandler. Definition at line 164 of file connectionhttpproxy.cpp. |
|
||||||||||||
|
This connection is called when e.g. the raw TCP connection was closed.
Implements ConnectionDataHandler. Definition at line 210 of file connectionhttpproxy.cpp. |
|
||||||||||||
|
This function is called for received from the underlying transport.
Implements ConnectionDataHandler. Definition at line 129 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 66 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 103 of file connectionhttpproxy.cpp. |
|
|
Use this periodically to receive data from the socket and to feed the parser.
Implements ConnectionBase. Definition at line 98 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 108 of file connectionhttpproxy.cpp. |
|
|
Sets the underlying transport connection. A possibly existing connection will be deleted.
Definition at line 72 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