--- /dev/null
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS =
+
+INCLUDES = -I$(oldincludedir)/libxml2
+
+## ##################################################
+
+include_HEADERS = \
+ ProxyInfoImpl.h \
+ ProxyInfoSysconfig.h
+
+
+noinst_LTLIBRARIES = lib@PACKAGE@_media.la
+
+## ##################################################
+
+lib@PACKAGE@_media_la_SOURCES = \
+ ProxyInfoSysconfig.cc
+
+
+lib@PACKAGE@_media_la_LIBADD = -lcurl
+
+## ##################################################
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/media/proxyinfoProxyInfoImpl.h
+ *
+*/
+#ifndef ZYPP_MEDIA_PROXYINFO_PROXYINFOIMPL_H
+#define ZYPP_MEDIA_PROXYINFO_PROXYINFOIMPL_H
+
+#include <string>
+#include <list>
+
+#include "zypp/media/ProxyInfo.h"
+
+namespace zypp {
+ namespace media {
+
+ struct ProxyInfo::Impl
+ {
+ /** Ctor */
+ Impl()
+ {}
+
+ /** Dtor */
+ virtual ~Impl()
+ {}
+
+ public:
+ /** */
+ virtual bool enabled() const = 0;
+ /** */
+ virtual std::string proxy(const std::string & prorocol_r) const = 0;
+ /** */
+ virtual std::list<std::string> noProxy() const = 0;
+
+ public:
+ /** Default Impl: empty sets. */
+ static shared_ptr<Impl> _nullimpl;
+ };
+
+
+///////////////////////////////////////////////////////////////////
+
+ } // namespace media
+} // namespace zypp
+
+#endif // ZYPP_MEDIA_PROXYINFO_PROXYINFOIMPL_H
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/media/proxyinfo/ProxyInfoSysconfig.cc
+ *
+*/
+
+#include <iostream>
+#include <fstream>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/String.h"
+#include "zypp/Pathname.h"
+
+#include "zypp/media/proxyinfo/ProxyInfoSysconfig.h"
+
+using namespace std;
+using namespace zypp::base;
+
+namespace zypp {
+ namespace media {
+
+
+ namespace proxyinfo {
+ map<string,string> sysconfigRead(const Pathname & _path)
+ {
+ DBG << "Load '" << _path << "'" << endl;
+ map<string,string> ret;
+
+ string line;
+ ifstream in( _path.asString().c_str() );
+ if ( in.fail() ) {
+ WAR << "Unable to load '" << _path << "'" << endl;
+ return ret;
+ }
+ while( getline( in, line ) ) {
+ if ( *line.begin() != '#' ) {
+ string::size_type pos = line.find( '=', 0 );
+ if ( pos != string::npos ) {
+ string key = str::trim( line.substr( 0, pos ) );
+ string value = str::trim( line.substr( pos + 1, line.length() - pos - 1 ) );
+ if ( value.length() >= 2 && *(value.begin()) == '"' &&
+ *(value.rbegin()) == '"' ) {
+ value = value.substr( 1, value.length() - 2 );
+ }
+ if ( value.length() >= 2 && *(value.begin()) == '\'' &&
+ *(value.rbegin()) == '\'' ) {
+ value = value.substr( 1, value.length() - 2 );
+ }
+ DBG << "KEY: '" << key << "' VALUE: '" << value << "'" << endl;
+ ret[key] = value;
+ }
+ }
+ }
+ return ret;
+ }
+ } // namespace proxyinfo
+
+ ProxyInfo_sysconfig::ProxyInfo_sysconfig(const Pathname & path)
+ : ProxyInfo::Impl()
+ {
+ map<string,string> data = proxyinfo::sysconfigRead(
+ path.relative()
+ ? "/etc/sysconfig" + path
+ : path);
+ map<string,string>::const_iterator it = data.find("PROXY_ENABLED");
+ if (it != data.end())
+ _enabled = it->second != "no";
+/* it = data.find("HTTP_PROXY");
+ if (it != data.end())
+ _http = it->second;
+ it = data.find("HTTPS_PROXY");
+ if (it != data.end())
+ _https = it->second;
+ it = data.find("FTP_PROXY");
+ if (it != data.end())
+ _ftp = it->second;*/
+ it = data.find("NO_PROXY");
+ if (it != data.end())
+ _no_proxy.push_back(it->second);
+#warning FIXME once splitting a string is in str:: namespace
+ }
+
+ std::string ProxyInfo_sysconfig::proxy(const std::string & protocol_r) const
+ { return ""; }
+
+
+ } // namespace media
+} // namespace zypp
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/media/proxyinfo/ProxyInfoSysconfig.h
+ *
+*/
+#ifndef ZYPP_MEDIA_PROXYINFO_PROXYINFOSYSCONFIG_H
+#define ZYPP_MEDIA_PROXYINFO_PROXYINFOSYSCONFIG_H
+
+#include <string>
+#include <list>
+
+#include "zypp/media/ProxyInfo.h"
+#include "zypp/media/proxyinfo/ProxyInfoImpl.h"
+
+namespace zypp {
+ namespace media {
+
+
+ class ProxyInfo_sysconfig : public ProxyInfo::Impl
+ {
+ public:
+ ProxyInfo_sysconfig(const Pathname & path);
+ /** */
+ bool enabled() const
+ { return _enabled; }
+ /** */
+ std::string proxy(const std::string & protocol_r) const;
+ /** */
+ std::list<std::string> noProxy() const
+ { return _no_proxy; }
+ private:
+ bool _enabled;
+ std::list<std::string> _no_proxy;
+ };
+
+ namespace proxyinfo {
+ std::map<std::string,std::string> sysconfigRead(const Pathname & _path);
+ } // namespace proxyinfo
+
+///////////////////////////////////////////////////////////////////
+
+ } // namespace media
+} // namespace zypp
+
+#endif // ZYPP_MEDIA_PROXYINFO_PROXYINFOSYSCONFIG_H