diff --git a/zypp/Url.cc b/zypp/Url.cc index 7ca3c61..81e8230 100644 --- a/zypp/Url.cc +++ b/zypp/Url.cc @@ -814,6 +814,13 @@ namespace zypp } // ----------------------------------------------------------------- + void + Url::removeQueryParam(const std::string ¶m) + { + m_impl->removeQueryParam(param); + } + + // ----------------------------------------------------------------- ViewOptions Url::getViewOptions() const { diff --git a/zypp/Url.h b/zypp/Url.h index e56bb17..a276e40 100644 --- a/zypp/Url.h +++ b/zypp/Url.h @@ -755,6 +755,16 @@ namespace zypp 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. + */ + void + removeQueryParam(const std::string ¶m); // ----------------- /** 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..11bcf89 100644 --- a/zypp/parser/RepoFileReader.cc +++ b/zypp/parser/RepoFileReader.cc @@ -43,6 +43,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 +57,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,7 +74,16 @@ 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_" ) + { + int pos = it->second.find(":", 0); + url.setQueryParam("proxy", it->second.substr(0, pos)); + url.setQueryParam("proxyport", it->second.substr(pos + 1)); + } else + url.setQueryParam("noproxy", "yes"); + } else ERR << "Unknown attribute in [" << *its << "]: " << it->second << " ignored" << endl; } info.setFilepath(is.path()); 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); // ----------------- /**