proxy settings: transfer to neon

If proxy settings are turned off in the config, the default system
proxy settings are used. This depends on ne_session_system_proxy(),
introduced in neon 0.29. The version is checked at configure time.  A
fallback if only an older version is found is intentionally not
present yet, the feature is meant to work in all cases.
This commit is contained in:
Patrick Ohly 2010-11-22 14:52:34 +01:00
parent b47ab860b3
commit 6008a3c4d4
4 changed files with 24 additions and 1 deletions

View File

@ -162,6 +162,14 @@ Session::Session(const boost::shared_ptr<Settings> &settings) :
}
ne_ssl_set_clicert(m_session, cert);
}
std::string proxyurl = settings->proxy();
if (proxyurl.empty()) {
ne_session_system_proxy(m_session, 0);
} else {
URI proxyuri = URI::parse(proxyurl);
ne_session_proxy(m_session, proxyuri.m_host.c_str(), proxyuri.m_port);
}
}
Session::~Session()

View File

@ -50,6 +50,11 @@ class Settings {
*/
virtual bool verifySSLCertificate() = 0;
/**
* proxy URL, empty for system default
*/
virtual std::string proxy() = 0;
/**
* fill in username and password for specified realm (URL?),
* throw error if not available

View File

@ -82,6 +82,16 @@ public:
return !m_context || m_context->getSSLVerifyServer();
}
virtual std::string proxy()
{
if (!m_context ||
!m_context->getUseProxy()) {
return "";
} else {
return m_context->getProxyHost();
}
}
virtual bool googleUpdateHack() { return m_googleUpdateHack; }
virtual bool googleChildHack() { return m_googleChildHack; }

View File

@ -11,7 +11,7 @@ AC_ARG_ENABLE_BACKEND(dav,
if test "$enable_dav" = "yes"; then
PKG_CHECK_MODULES(LIBICAL, libical)
PKG_CHECK_MODULES(NEON, neon)
PKG_CHECK_MODULES(NEON, neon >= 0.29)
AC_DEFINE(ENABLE_DAV, 1, [DAV available])
AC_DEFINE(ENABLE_ICAL, 1, [libical in use])
BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $NEON_CFLAGS"