35 #define RX_SPLIT_URL "^([^:/?#]+:|)" \
56 LDAPUrl(LDAPUrl &&) =
default;
57 LDAPUrl &operator=(
const LDAPUrl &) =
default;
58 LDAPUrl &operator=(LDAPUrl &&) =
default;
59 LDAPUrl(
const LDAPUrl &url) :
UrlBase(url) {}
60 ~LDAPUrl()
override =
default;
63 clone()
const override
65 return new LDAPUrl(*
this);
69 getKnownSchemes()
const override
80 config(
"sep_pathparams",
"");
82 config(
"psep_querystr",
"?");
83 config(
"vsep_querystr",
"");
88 config(
"require_host",
"y");
91 config(
"rx_username",
"");
92 config(
"rx_password",
"");
93 config(
"rx_fragment",
"");
94 config(
"rx_pathparams",
"");
100 static const char *
const keys[] = {
101 "attrs",
"scope",
"filter",
"exts",
NULL
105 if(
pvec.size() <= 4)
107 for(
size_t i=0;
i<
pvec.size();
i++)
118 _(
"Invalid LDAP URL query string")
127 static const char *
const keys[] = {
128 "attrs",
"scope",
"filter",
"exts",
NULL
135 std::string
safe(config(
"safe_querystr"));
136 std::string
psep(config(
"psep_querystr"));
137 for(std::string::size_type
i=0;
i<
safe.size();
i++)
139 if(
psep.find(
safe[
i]) == std::string::npos)
144 zypp::url::ParamMap::const_iterator
p;
148 for(
size_t i=0;
i<4;
i++)
159 str::form(
_(
"Invalid LDAP URL query parameter '%s'"),
164 setQueryStringVec(
pvec);
171 config(
"psep_querystr"),
172 config(
"vsep_querystr"),
173 config(
"safe_querystr"),
186 using UrlBySchemeMap = std::map<std::string, UrlRef>;
195 ref.
reset(
new LDAPUrl());
204 zypp::url::ViewOption::EMPTY_AUTHORITY);
206 ref->
config(
"with_authority",
"n");
207 ref->
config(
"require_pathname",
"m");
219 ref->
config(
"with_authority",
"y");
220 ref->
config(
"with_port",
"n");
221 ref->
config(
"rx_username",
"");
222 ref->
config(
"rx_password",
"");
227 ref->
config(
"require_host",
"m");
234 ref->
config(
"path_encode_slash2",
"y");
266 isRegisteredScheme(
const std::string &scheme)
const
272 getRegisteredSchemes()
const
290 static UrlByScheme
_v;
314 : m_impl( url.m_impl)
319 _(
"Unable to clone Url object")
332 _(
"Invalid empty Url object reference")
345 _(
"Unable to parse Url components")
359 _(
"Unable to parse Url components")
405 std::string scheme = out[1];
406 if (scheme.size() > 1)
411 std::string query = out[4];
412 if (query.size() > 1)
413 query = query.substr(1);
414 std::string fragment = out[5];
415 if (fragment.size() > 1)
416 fragment = fragment.substr(1);
477 static const char * val[] = {
"cd",
"dvd",
"dir",
"hd",
"iso",
"file" };
483 static const char * val[] = {
"http",
"https",
"nfs",
"nfs4",
"smb",
"cifs",
"ftp",
"sftp",
"tftp" };
489 static const char * val[] = {
"cd",
"dvd" };
495 static const char * val[] = {
"http",
"https",
"ftp",
"sftp",
"tftp" };
528 ViewOption::WITH_SCHEME +
529 ViewOption::WITH_USERNAME +
530 ViewOption::WITH_PASSWORD +
531 ViewOption::WITH_HOST +
532 ViewOption::WITH_PORT +
533 ViewOption::WITH_PATH_NAME +
534 ViewOption::WITH_PATH_PARAMS +
535 ViewOption::WITH_QUERY_STR +
536 ViewOption::WITH_FRAGMENT);
909 namespace hotfix1050625 {
911 {
return url_r.m_impl->asString1050625(); }
UrlBySchemeMap urlByScheme
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
bool schemeIsPlugin() const
void delQueryParams(const std::set< std::string > ¶ms)
remove multiple query parameters at once
std::string getScheme() const
Returns the scheme name of the URL.
std::string asCompleteString() const
Returns a complete string representation of the Url object.
void setViewOptions(const ViewOptions &vopts)
Change the view options of the current object.
void setAuthority(const std::string &authority)
Set the authority component in the URL.
zypp::url::ParamMap getPathParamsMap(EEncoding eflag=zypp::url::E_DECODED) const
Returns a string map with path parameter keys and values.
zypp::url::ParamVec getPathParamsVec() const
Returns a vector with path parameter substrings.
void setQueryString(const std::string &querystr)
Set the query string in the URL.
bool schemeIsRemote() const
std::string getPathParams() const
Returns the path parameters from the URL.
std::string asString() const
Returns a default string representation of the Url object.
std::string getPathData() const
Returns the encoded path component of the URL.
std::string getPathParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified path parameter.
std::string getAuthority() const
Returns the encoded authority component of the URL.
std::string getUsername(EEncoding eflag=zypp::url::E_DECODED) const
Returns the username from the URL authority.
static bool isRegisteredScheme(const std::string &scheme)
Returns if scheme name is registered.
void setFragment(const std::string &fragment, EEncoding eflag=zypp::url::E_DECODED)
Set the fragment string in the URL.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
void setQueryStringVec(const zypp::url::ParamVec &qvec)
Set the query parameters.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
void setPathName(const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
Set the path name.
void setPathParamsMap(const zypp::url::ParamMap &pmap)
Set the path parameters.
ViewOptions getViewOptions() const
Return the view options of the current object.
bool schemeIsDownloading() const
void setPathData(const std::string &pathdata)
Set the path data component in the URL.
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
void setHost(const std::string &host)
Set the hostname or IP in the URL authority.
void setPort(const std::string &port)
Set the port number in the URL authority.
void delQueryParam(const std::string ¶m)
remove the specified query parameter.
void setPathParamsVec(const zypp::url::ParamVec &pvec)
Set the path parameters.
bool isValid() const
Verifies the Url.
std::string getFragment(EEncoding eflag=zypp::url::E_DECODED) const
Returns the encoded fragment component of the URL.
static url::UrlRef parseUrl(const std::string &encodedUrl)
Parse a percent-encoded URL string.
void setPathParam(const std::string ¶m, const std::string &value)
Set or add value for the specified path parameter.
void setPassword(const std::string &pass, EEncoding eflag=zypp::url::E_DECODED)
Set the password in the URL authority.
void setPathParams(const std::string ¶ms)
Set the path parameters.
Url & operator=(const std::string &encodedUrl)
Assigns parsed percent-encoded URL string to the object.
static bool registerScheme(const std::string &scheme, url::UrlRef urlImpl)
Register a scheme-specific implementation.
std::string getQueryString() const
Returns the encoded query string component of the URL.
bool isValidScheme(const std::string &scheme) const
Verifies the specified scheme name.
void setQueryParam(const std::string ¶m, const std::string &value)
Set or add value for the specified query parameter.
static zypp::url::UrlSchemes getRegisteredSchemes()
Returns all registered scheme names.
zypp::url::ParamVec getQueryStringVec() const
Returns a vector with query string parameter substrings.
bool schemeIsLocal() const
void setUsername(const std::string &user, EEncoding eflag=zypp::url::E_DECODED)
Set the username in the URL authority.
zypp::url::UrlSchemes getKnownSchemes() const
Returns scheme names known to this object.
void appendPathName(const Pathname &path_r, EEncoding eflag_r=zypp::url::E_DECODED)
Extend the path name.
void setScheme(const std::string &scheme)
Set the scheme name in the URL.
std::string getPassword(EEncoding eflag=zypp::url::E_DECODED) const
Returns the password from the URL authority.
bool schemeIsVolatile() const
zypp::url::ParamMap getQueryStringMap(EEncoding eflag=zypp::url::E_DECODED) const
Returns a string map with query parameter and their values.
std::string getPort() const
Returns the port from the URL authority.
void setQueryStringMap(const zypp::url::ParamMap &qmap)
Set the query parameters.
const std::string & asString() const
String representation.
Regular expression match result.
virtual void setQueryString(const std::string &querystr)
Set the query string in the URL.
virtual std::string getQueryString() const
Returns the encoded query string component of the URL.
virtual std::string getPort() const
Returns the port number from the URL authority.
virtual void setScheme(const std::string &scheme)
Set the scheme name in the URL.
virtual void setHost(const std::string &host)
Set the hostname or IP in the URL authority.
virtual zypp::url::ParamMap getPathParamsMap(EEncoding eflag) const
Returns a string map with path parameter keys and values.
virtual zypp::url::ParamVec getPathParamsVec() const
Returns a vector with encoded path parameter substrings.
virtual std::string getUsername(EEncoding eflag) const
Returns the username from the URL authority.
virtual UrlSchemes getKnownSchemes() const
Returns scheme names known by this object.
virtual std::string getAuthority() const
Returns the encoded authority component of the URL.
virtual void setQueryParam(const std::string ¶m, const std::string &value)
Set or add value for the specified query parameter.
std::string config(const std::string &opt) const
Get the value of a UrlBase configuration variable.
virtual void setPathParamsVec(const zypp::url::ParamVec &pvec)
Set the path parameters.
virtual std::string getFragment(EEncoding eflag) const
Returns the encoded fragment component of the URL.
virtual std::string getPathParams() const
Returns the encoded path parameters from the URL.
virtual std::string getPassword(EEncoding eflag) const
Returns the password from the URL authority.
virtual std::string getScheme() const
Returns the scheme name of the URL.
virtual zypp::url::ParamMap getQueryStringMap(EEncoding eflag) const
Returns a string map with query parameter and their values.
virtual void setUsername(const std::string &user, EEncoding eflag)
Set the username in the URL authority.
virtual std::string getPathParam(const std::string ¶m, EEncoding eflag) const
Return the value for the specified path parameter.
virtual void setQueryStringMap(const zypp::url::ParamMap &qmap, EEncoding eflag)
Set the query parameters.
virtual void setPathParamsMap(const zypp::url::ParamMap &pmap)
Set the path parameters.
virtual std::string asString() const
Returns a default string representation of the Url object.
void delQueryParams(const std::set< std::string > ¶ms)
virtual bool isKnownScheme(const std::string &scheme) const
Returns if scheme name is known to this object.
virtual std::string getHost(EEncoding eflag) const
Returns the hostname or IP from the URL authority.
virtual void setPathData(const std::string &pathdata)
Set the path data component in the URL.
virtual void setPathName(const std::string &path, EEncoding eflag)
Set the path name.
virtual void setPort(const std::string &port)
Set the port number in the URL authority.
virtual std::string getPathData() const
Returns the encoded path component of the URL.
virtual bool isValid() const
Verifies the Url.
virtual std::string getPathName(EEncoding eflag) const
Returns the path name from the URL.
virtual void setFragment(const std::string &fragment, EEncoding eflag)
Set the fragment string in the URL.
virtual bool isValidScheme(const std::string &scheme) const
Verifies specified scheme name.
virtual zypp::url::ParamVec getQueryStringVec() const
Returns a vector with query string parameter substrings.
virtual std::string getQueryParam(const std::string ¶m, EEncoding eflag) const
Return the value for the specified query parameter.
void setViewOptions(const ViewOptions &vopts)
Change the view options of the current object.
virtual void setQueryStringVec(const zypp::url::ParamVec &qvec)
Set the query parameters.
virtual void delQueryParam(const std::string ¶m)
remove the specified query parameter.
virtual void setPassword(const std::string &pass, EEncoding eflag)
Set the password in the URL authority.
virtual void setPathParam(const std::string ¶m, const std::string &value)
Set or add value for the specified path parameter.
virtual void init(const std::string &scheme, const std::string &authority, const std::string &pathdata, const std::string &querystr, const std::string &fragment)
Initializes current object with new URL components.
virtual void setPathParams(const std::string ¶ms)
Set the path parameters.
virtual void setAuthority(const std::string &authority)
Set the authority component in the URL.
ViewOptions getViewOptions() const
Return the view options of the current object.
Base class for all URL exceptions.
Thrown if the url or a component can't be parsed at all.
String related utilities and Regular expression matching.
std::string asString(const Url &url_r)
std::string toLower(const std::string &s)
Return lowercase version of s.
bool regex_match(const std::string &s, smatch &matches, const regex ®ex)
\relates regex \ingroup ZYPP_STR_REGEX \relates regex \ingroup ZYPP_STR_REGEX
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
RWCOW_pointer< UrlBase > UrlRef
Copy-On-Write Url reference.
std::string encode(const std::string &str, const std::string &safe, EEncoding eflag)
Encodes a string using URL percent encoding.
std::vector< std::string > ParamVec
A parameter vector container.
std::string join(const ParamVec &pvec, const std::string &psep)
Join parameter vector to a string.
std::map< std::string, std::string > ParamMap
A parameter map container.
std::vector< std::string > UrlSchemes
Vector of URL scheme names.
@ E_DECODED
Flag to request decoded string(s).
@ E_ENCODED
Flag to request encoded string(s).
std::string decode(const std::string &str, bool allowNUL)
Decodes a URL percent encoded string.
Easy-to use interface to the ZYPP dependency resolver.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
bool operator!=(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Url::asString() view options.
#define arrayBegin(A)
Simple C-array iterator.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.