1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/media/proxyinfo/ProxyInfoLibproxy.cc
16 #include "zypp/base/Logger.h"
17 #include "zypp/base/String.h"
18 #include "zypp/Pathname.h"
20 #include "zypp/media/proxyinfo/ProxyInfoLibproxy.h"
23 using namespace zypp::base;
28 ProxyInfoLibproxy::ProxyInfoLibproxy()
31 _factory = px_proxy_factory_new();
32 _enabled = !(_factory == NULL);
35 ProxyInfoLibproxy::~ProxyInfoLibproxy()
38 px_proxy_factory_free(_factory);
44 std::string ProxyInfoLibproxy::proxy(const Url & url_r) const
49 const url::ViewOption vopt =
50 url::ViewOption::WITH_SCHEME
51 + url::ViewOption::WITH_HOST
52 + url::ViewOption::WITH_PORT
53 + url::ViewOption::WITH_PATH_NAME;
55 char **proxies = px_proxy_factory_get_proxies(_factory,
56 (char *)url_r.asString(vopt).c_str());
60 /* cURL can only handle HTTP proxies, not SOCKS. And can only handle
61 one. So look through the list and find an appropriate one. */
64 for (int i = 0; proxies[i]; i++) {
66 !strncmp(proxies[i], "http://", 7))
76 std::string sresult = result;
81 ProxyInfo::NoProxyIterator ProxyInfoLibproxy::noProxyBegin() const
82 { return _no_proxy.begin(); }
84 ProxyInfo::NoProxyIterator ProxyInfoLibproxy::noProxyEnd() const
85 { return _no_proxy.end(); }