/**
* \file zypp/url/UrlBase.cc
*/
-#include <zypp/url/UrlBase.h>
-#include <zypp/base/String.h>
-#include <zypp/base/Gettext.h>
-#include <zypp/base/Regex.h>
+#include "zypp/url/UrlBase.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Gettext.h"
+#include "zypp/base/Regex.h"
#include <stdexcept>
#include <climits>
const std::string &querystr,
const std::string &fragment)
{
- setScheme(scheme);
+ if ( scheme.empty() && *pathdata.c_str() == '/' )
+ setScheme("file");
+ else
+ setScheme(scheme);
+
setAuthority(authority);
setPathData(pathdata);
setQueryString(querystr);
config("vsep_pathparam").empty())
{
ZYPP_THROW(UrlNotSupportedException(
- _("Path parameter parsing not supported for this URL")
+ "Path parameter parsing not supported for this URL"
));
}
zypp::url::ParamMap pmap;
setUsername(s.substr(0, p), zypp::url::E_ENCODED);
s = s.substr(p+1);
}
- q = s.rfind(']');
- if ((p = s.rfind(':')) != std::string::npos && p > q+1)
+ if ((p = s.rfind(':')) != std::string::npos && ( (q = s.rfind(']')) == std::string::npos || q < p) )
{
-
setHost(s.substr(0, p));
setPort(s.substr(p+1));
}
config("vsep_pathparam").empty())
{
ZYPP_THROW(UrlNotSupportedException(
- _("Path Parameter parsing not supported for this URL")
+ "Path Parameter parsing not supported for this URL"
));
}
setPathParams(
setQueryStringMap(pmap);
}
+ // ---------------------------------------------------------------
+ void
+ UrlBase::delQueryParam(const std::string ¶m)
+ {
+ zypp::url::ParamMap pmap( getQueryStringMap(zypp::url::E_DECODED));
+ pmap.erase(param);
+ setQueryStringMap(pmap);
+ }
+
// ---------------------------------------------------------------
std::string
{
struct in6_addr ip;
std::string temp( host.substr(1, host.size()-2));
-
+
return inet_pton(AF_INET6, temp.c_str(), &ip) > 0;
}
else