diff --git a/zypp/media/MediaCurl.cc b/zypp/media/MediaCurl.cc index 086bdf1..f7cce4e 100644 --- a/zypp/media/MediaCurl.cc +++ b/zypp/media/MediaCurl.cc @@ -285,12 +285,17 @@ void fillSettingsFromUrl( const Url &url, TransferSettings &s ) string proxy = url.getQueryParam( "proxy" ); if ( ! proxy.empty() ) { - string proxyport( url.getQueryParam( "proxyport" ) ); - if ( ! proxyport.empty() ) { - proxy += ":" + proxyport; + if ( proxy == "_none_" ) { + s.setProxyEnabled(false); } - s.setProxy(proxy); - s.setProxyEnabled(true); + else { + string proxyport( url.getQueryParam( "proxyport" ) ); + if ( ! proxyport.empty() ) { + proxy += ":" + proxyport; + } + s.setProxy(proxy); + s.setProxyEnabled(true); + } } // HTTP authentication type @@ -600,7 +605,11 @@ void MediaCurl::setupEasy() SET_OPTION(CURLOPT_PROXYUSERPWD, proxyuserpwd.c_str()); } } - + else + { + SET_OPTION(CURLOPT_NOPROXY, "*"); + } + /** Speed limits */ if ( _settings.minDownloadSpeed() != 0 ) { diff --git a/zypp/parser/RepoFileReader.cc b/zypp/parser/RepoFileReader.cc index 9196baf..e7945f9 100644 --- a/zypp/parser/RepoFileReader.cc +++ b/zypp/parser/RepoFileReader.cc @@ -12,6 +12,7 @@ #include #include "zypp/base/Logger.h" #include "zypp/base/String.h" +#include "zypp/base/Regex.h" #include "zypp/base/InputStream.h" #include "zypp/base/UserRequestException.h" @@ -43,6 +44,7 @@ namespace zypp { RepoInfo info; info.setAlias(*its); + Url url; for ( IniDict::entry_const_iterator it = dict.entriesBegin(*its); it != dict.entriesEnd(*its); @@ -56,7 +58,7 @@ namespace zypp else if ( it->first == "priority" ) info.setPriority( str::strtonum( it->second ) ); else if ( it->first == "baseurl" && !it->second.empty()) - info.addBaseUrl( Url(it->second) ); + url = it->second; else if ( it->first == "path" ) info.setPath( Pathname(it->second) ); else if ( it->first == "type" ) @@ -73,9 +75,25 @@ namespace zypp info.setKeepPackages( str::strToTrue( it->second ) ); else if ( it->first == "service" ) info.setService( it->second ); - else + else if ( it->first == "proxy" ) + { + if (it->second != "_none_" ) + { + str::regex ex("^(.*):([0-9]+)$"); + str::smatch what; + if(str::regex_match(it->second, what, ex)){ + url.setQueryParam("proxy", what[1]); + url.setQueryParam("proxyport", what[2]); + } + } else + url.setQueryParam("noproxy", "yes"); + } else ERR << "Unknown attribute in [" << *its << "]: " << it->second << " ignored" << endl; } + + if (url.isValid()) + info.addBaseUrl(url); + info.setFilepath(is.path()); MIL << info << endl; // add it to the list. diff --git a/zypp/url/UrlBase.cc b/zypp/url/UrlBase.cc index d42a032..c8578c1 100644 --- a/zypp/url/UrlBase.cc +++ b/zypp/url/UrlBase.cc @@ -1246,6 +1246,14 @@ namespace zypp setQueryStringMap(pmap); } + // --------------------------------------------------------------- + void + UrlBase::removeQueryParam(const std::string ¶m) + { + zypp::url::ParamMap pmap( getQueryStringMap(zypp::url::E_DECODED)); + pmap.erase(param); + setQueryStringMap(pmap); + } // --------------------------------------------------------------- std::string diff --git a/zypp/url/UrlBase.h b/zypp/url/UrlBase.h index 09be00b..d106024 100644 --- a/zypp/url/UrlBase.h +++ b/zypp/url/UrlBase.h @@ -862,6 +862,16 @@ namespace zypp virtual void setQueryParam(const std::string ¶m, const std::string &value); + /** + * \brief Delete the specified query parameter. + * \param param The decoded query parameter name. + * \throws url::UrlNotSupportedException if parameter parsing + * is not supported for a URL (scheme). + * \throws url::UrlDecodingException if the decoded result string + * would contain a '\\0' character. + */ + virtual void + removeQueryParam(const std::string ¶m); // ----------------- /**