diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-03-16 11:56:22 (GMT) |
|---|---|---|
| committer | Tobias Markmann <tm@ayena.de> | 2015-03-16 11:56:22 (GMT) |
| commit | 1f072d6858f98e2717f50cffca4acb17e663267d (patch) | |
| tree | 6f97e65f014b05bd18398da58e262d677eecd286 /Swiften/Client | |
| parent | cb9f7ecff59034e9678b1aca22b608b6e2522e1a (diff) | |
| download | swift-1f072d6858f98e2717f50cffca4acb17e663267d.zip swift-1f072d6858f98e2717f50cffca4acb17e663267d.tar.bz2 | |
Add ability to modify HTTP CONNECT proxy initialization
This patch adds HTTPTrafficFilter and integrates it into
HTTPConnectProxiedConnection. This allows the HTTP CONNECT proxy
initialization process to be customized.
Test-Information:
Added a unit test that verifies the new functionality.
Change-Id: I0b93c319fb205487b8be65717276cd0dd38851a3
Diffstat (limited to 'Swiften/Client')
| -rw-r--r-- | Swiften/Client/ClientOptions.h | 12 | ||||
| -rw-r--r-- | Swiften/Client/CoreClient.cpp | 4 |
2 files changed, 13 insertions, 3 deletions
diff --git a/Swiften/Client/ClientOptions.h b/Swiften/Client/ClientOptions.h index 884b1bb..20e7443 100644 --- a/Swiften/Client/ClientOptions.h +++ b/Swiften/Client/ClientOptions.h @@ -1,18 +1,22 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <boost/shared_ptr.hpp> + #include <Swiften/Base/URL.h> #include <Swiften/Base/SafeString.h> namespace Swift { + class HTTPTrafficFilter; + struct ClientOptions { enum UseTLS { NeverUseTLS, UseTLSWhenAvailable, RequireTLS }; @@ -131,8 +135,14 @@ namespace Swift { * If this and matching Password are non-empty, BOSH connections over * HTTP CONNECT proxies will use these credentials for proxy access. * Default: empty (no authentication needed by the proxy) */ SafeString boshHTTPConnectProxyAuthID; SafeString boshHTTPConnectProxyAuthPassword; + + /** + * This can be initialized with a custom HTTPTrafficFilter, which allows HTTP CONNECT + * proxy initialization to be customized. + */ + boost::shared_ptr<HTTPTrafficFilter> httpTrafficFilter; }; } diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp index 4416ee4..842488d 100644 --- a/Swiften/Client/CoreClient.cpp +++ b/Swiften/Client/CoreClient.cpp @@ -1,8 +1,8 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Client/CoreClient.h> @@ -93,13 +93,13 @@ void CoreClient::connect(const ClientOptions& o) { } case ClientOptions::HTTPConnectProxy: { SWIFT_LOG(debug) << " with manual configured HTTPConnect proxy" << std::endl; std::string proxyHostname = o.manualProxyHostname.empty() ? systemHTTPConnectProxy.getAddress().toString() : o.manualProxyHostname; int proxyPort = o.manualProxyPort == -1 ? systemHTTPConnectProxy.getPort() : o.manualProxyPort; SWIFT_LOG(debug) << "Proxy: " << proxyHostname << ":" << proxyPort << std::endl; - proxyConnectionFactories.push_back(new HTTPConnectProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), proxyHostname, proxyPort)); + proxyConnectionFactories.push_back(new HTTPConnectProxiedConnectionFactory(networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory(), proxyHostname, proxyPort, o.httpTrafficFilter)); useDirectConnection = false; break; } } std::vector<ConnectionFactory*> connectionFactories(proxyConnectionFactories); if (useDirectConnection) { |
Swift