34 #include <sys/types.h> 36 #include <sys/mount.h> 41 #define DETECT_DIR_INDEX 0 42 #define CONNECT_TIMEOUT 60 43 #define TRANSFER_TIMEOUT_MAX 60 * 60 45 #define EXPLICITLY_NO_PROXY "_none_" 47 #undef CURLVERSION_AT_LEAST 48 #define CURLVERSION_AT_LEAST(M,N,O) LIBCURL_VERSION_NUM >= ((((M)<<8)+(N))<<8)+(O) 58 extern "C" void _do_free_once()
60 curl_global_cleanup();
63 extern "C" void globalFreeOnce()
68 extern "C" void _do_init_once()
70 CURLcode ret = curl_global_init( CURL_GLOBAL_ALL );
73 WAR <<
"curl global init failed" << endl;
86 inline void globalInitOnce()
91 int log_curl(CURL *
curl, curl_infotype info,
92 char *ptr,
size_t len,
void *max_lvl)
98 case CURLINFO_TEXT: lvl = 1; pfx =
"*";
break;
99 case CURLINFO_HEADER_IN: lvl = 2; pfx =
"<";
break;
100 case CURLINFO_HEADER_OUT: lvl = 2; pfx =
">";
break;
103 if( lvl > 0 && max_lvl != NULL && lvl <= *((
long *)max_lvl))
105 std::string msg(ptr, len);
106 std::list<std::string> lines;
107 std::list<std::string>::const_iterator line;
109 for(line = lines.begin(); line != lines.end(); ++line)
111 DBG << pfx <<
" " << *line << endl;
117 static size_t log_redirects_curl(
char *ptr,
size_t size,
size_t nmemb,
void *userdata)
121 char * lstart = ptr, * lend = ptr;
123 size_t max = size * nmemb;
124 while (pos + 1 < max)
127 for (lstart = lend; *lend !=
'\n' && pos < max; ++lend, ++pos);
130 if ( lstart[0] ==
'L' 138 && lstart[8] ==
':' )
140 std::string line { lstart, *(lend-1)==
'\r' ? lend-1 : lend };
141 DBG <<
"redirecting to " << line << endl;
143 *
reinterpret_cast<std::string *
>( userdata ) = line;
169 inline int getZYPP_MEDIA_CURL_IPRESOLVE()
172 if (
const char * envp = getenv(
"ZYPP_MEDIA_CURL_IPRESOLVE" ) )
174 WAR <<
"env set: $ZYPP_MEDIA_CURL_IPRESOLVE='" << envp <<
"'" << endl;
175 if ( strcmp( envp,
"4" ) == 0 ) ret = 4;
176 else if ( strcmp( envp,
"6" ) == 0 ) ret = 6;
184 static int _v = getZYPP_MEDIA_CURL_IPRESOLVE();
195 ProgressData( CURL *_curl, time_t _timeout = 0,
const Url & _url = Url(),
196 ByteCount expectedFileSize_r = 0,
197 callback::SendReport<DownloadProgressReport> *_report =
nullptr )
212 callback::SendReport<DownloadProgressReport> *
report;
229 void updateStats(
double dltotal = 0.0,
double dlnow = 0.0 )
237 if ( dlnow && dlnow !=
_dnlNow )
278 int reportProgress()
const 308 inline void escape(
string & str_r,
309 const char char_r,
const string & escaped_r ) {
311 pos != string::npos; pos = str_r.find( char_r, pos ) ) {
312 str_r.replace( pos, 1, escaped_r );
316 inline string escapedPath(
string path_r ) {
317 escape( path_r,
' ',
"%20" );
321 inline string unEscape(
string text_r ) {
322 char * tmp = curl_unescape( text_r.c_str(), 0 );
336 std::string param(
url.getQueryParam(
"timeout"));
339 long num = str::strtonum<long>(param);
344 if ( !
url.getUsername().empty() )
347 if (
url.getPassword().size() )
353 if ( (
url.getScheme() ==
"ftp" ||
url.getScheme() ==
"tftp" ) && s.
username().empty() )
357 if (
url.getScheme() ==
"https" )
362 std::string verify(
url.getQueryParam(
"ssl_verify"));
363 if( verify.empty() ||
369 else if( verify ==
"no")
376 std::vector<std::string> flags;
377 std::vector<std::string>::const_iterator flag;
378 str::split( verify, std::back_inserter(flags),
",");
379 for(flag = flags.begin(); flag != flags.end(); ++flag)
383 else if( *flag ==
"peer")
391 Pathname ca_path(
url.getQueryParam(
"ssl_capath") );
392 if( ! ca_path.empty())
400 Pathname client_cert(
url.getQueryParam(
"ssl_clientcert") );
401 if( ! client_cert.empty())
408 Pathname client_key(
url.getQueryParam(
"ssl_clientkey") );
409 if( ! client_key.empty())
417 param =
url.getQueryParam(
"proxy" );
418 if ( ! param.empty() )
429 string proxyport(
url.getQueryParam(
"proxyport" ) );
430 if ( ! proxyport.empty() ) {
431 param +=
":" + proxyport;
438 param =
url.getQueryParam(
"proxyuser" );
439 if ( ! param.empty() )
446 param =
url.getQueryParam(
"auth");
447 if (!param.empty() && (
url.getScheme() ==
"http" ||
url.getScheme() ==
"https"))
451 CurlAuthData::auth_type_str2long(param);
455 DBG <<
"Rethrowing as MediaUnauthorizedException.";
462 param =
url.getQueryParam(
"head_requests");
463 if( !param.empty() && param ==
"no" )
480 s.
setProxy( u.asString( url::ViewOption::WITH_SCHEME + url::ViewOption::WITH_HOST + url::ViewOption::WITH_PORT ) );
493 Pathname MediaCurl::_cookieFile =
"/var/lib/YaST2/cookies";
505 static const std::string
_value(
507 "X-ZYpp-AnonymousId: %s",
508 Target::anonymousUniqueId(
Pathname() ).c_str() ) )
523 static const std::string
_value(
525 "X-ZYpp-DistributionFlavor: %s",
526 Target::distributionFlavor(
Pathname() ).c_str() ) )
541 static const std::string
_value(
543 "ZYpp %s (curl %s) %s" 545 , curl_version_info(CURLVERSION_NOW)->version
546 , Target::targetDistribution(
Pathname() ).c_str()
555 #define SET_OPTION(opt,val) do { \ 556 ret = curl_easy_setopt ( _curl, opt, val ); \ 558 ZYPP_THROW(MediaCurlSetOptException(_url, _curlError)); \ 562 #define SET_OPTION_OFFT(opt,val) SET_OPTION(opt,(curl_off_t)val) 563 #define SET_OPTION_LONG(opt,val) SET_OPTION(opt,(long)val) 564 #define SET_OPTION_VOID(opt,val) SET_OPTION(opt,(void*)val) 566 MediaCurl::MediaCurl(
const Url & url_r,
567 const Pathname & attach_point_hint_r )
577 MIL <<
"MediaCurl::MediaCurl(" << url_r <<
", " << attach_point_hint_r <<
")" << endl;
585 char *atemp = ::strdup( apath.
asString().c_str());
588 atemp == NULL || (atest=::mkdtemp(atemp)) == NULL)
590 WAR <<
"attach point " << ainfo.
path()
591 <<
" is not useable for " << url_r.
getScheme() << endl;
594 else if( atest != NULL)
642 curl_version_info_data *curl_info = NULL;
643 curl_info = curl_version_info(CURLVERSION_NOW);
645 if (curl_info->protocols)
647 const char *
const *proto;
650 for(proto=curl_info->protocols; !found && *proto; ++proto)
652 if( scheme == std::string((
const char *)*proto))
657 std::string msg(
"Unsupported protocol '");
668 char *ptr = getenv(
"ZYPP_MEDIA_CURL_DEBUG");
669 _curlDebug = (ptr && *ptr) ? str::strtonum<long>( ptr) : 0L;
672 curl_easy_setopt(
_curl, CURLOPT_VERBOSE, 1L);
673 curl_easy_setopt(
_curl, CURLOPT_DEBUGFUNCTION, log_curl);
678 curl_easy_setopt(
_curl, CURLOPT_HEADERFUNCTION, log_redirects_curl);
680 CURLcode ret = curl_easy_setopt(
_curl, CURLOPT_ERRORBUFFER,
_curlError );
727 case 4:
SET_OPTION(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
break;
728 case 6:
SET_OPTION(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
break;
752 #if CURLVERSION_AT_LEAST(7,19,4) 754 SET_OPTION( CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS );
756 #if CURLVERSION_AT_LEAST(7,60,0) // SLE15+ 757 SET_OPTION( CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS );
775 #ifdef CURLSSLOPT_ALLOW_BEAST 777 ret = curl_easy_setopt(
_curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST );
786 SET_OPTION(CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
802 if (use_auth.empty())
803 use_auth =
"digest,basic";
805 if( auth != CURLAUTH_NONE)
807 DBG <<
"Enabling HTTP authentication methods: " << use_auth
808 <<
" (CURLOPT_HTTPAUTH=" << auth <<
")" << std::endl;
817 SET_OPTION(CURLOPT_PROXYAUTH, CURLAUTH_BASIC|CURLAUTH_DIGEST|CURLAUTH_NTLM );
827 if ( proxyuserpwd.empty() )
832 DBG <<
"Proxy: ~/.curlrc does not contain the proxy-user option" << endl;
836 DBG <<
"Proxy: using proxy-user from ~/.curlrc" << endl;
844 if ( ! proxyuserpwd.empty() )
846 SET_OPTION(CURLOPT_PROXYUSERPWD, unEscape( proxyuserpwd ).c_str());
849 #if CURLVERSION_AT_LEAST(7,19,4) 854 DBG <<
"Proxy: explicitly NOPROXY" << endl;
860 DBG <<
"Proxy: not explicitly set" << endl;
861 DBG <<
"Proxy: libcurl may look into the environment" << endl;
872 #if CURLVERSION_AT_LEAST(7,15,5) 884 MIL <<
"No cookies requested" << endl;
889 #if CURLVERSION_AT_LEAST(7,18,0) 894 for ( TransferSettings::Headers::const_iterator it = vol_settings.
headersBegin();
926 _curl = curl_easy_init();
963 curl_easy_cleanup(
_curl );
1079 bool timeout_reached)
const 1084 if (filename.
empty())
1093 case CURLE_UNSUPPORTED_PROTOCOL:
1094 err =
" Unsupported protocol";
1097 err +=
" or redirect (";
1102 case CURLE_URL_MALFORMAT:
1103 case CURLE_URL_MALFORMAT_USER:
1106 case CURLE_LOGIN_DENIED:
1110 case CURLE_HTTP_RETURNED_ERROR:
1112 long httpReturnCode = 0;
1113 CURLcode infoRet = curl_easy_getinfo(
_curl,
1114 CURLINFO_RESPONSE_CODE,
1116 if ( infoRet == CURLE_OK )
1118 string msg =
"HTTP response: " +
str::numstring( httpReturnCode );
1119 switch ( httpReturnCode )
1125 DBG << msg <<
" Login failed (URL: " <<
url.
asString() <<
")" << std::endl;
1126 DBG <<
"MediaUnauthorizedException auth hint: '" << auth_hint <<
"'" << std::endl;
1141 if (
url.
getHost().find(
".suse.com") != string::npos )
1142 msg403 =
_(
"Visit the SUSE Customer Center to check whether your registration is valid and has not expired.");
1143 else if (
url.
asString().find(
"novell.com") != string::npos)
1144 msg403 =
_(
"Visit the Novell Customer Center to check whether your registration is valid and has not expired.");
1157 string msg =
"Unable to retrieve HTTP response:";
1163 case CURLE_FTP_COULDNT_RETR_FILE:
1164 #if CURLVERSION_AT_LEAST(7,16,0) 1165 case CURLE_REMOTE_FILE_NOT_FOUND:
1167 case CURLE_FTP_ACCESS_DENIED:
1168 case CURLE_TFTP_NOTFOUND:
1169 err =
"File not found";
1172 case CURLE_BAD_PASSWORD_ENTERED:
1173 case CURLE_FTP_USER_PASSWORD_INCORRECT:
1174 err =
"Login failed";
1176 case CURLE_COULDNT_RESOLVE_PROXY:
1177 case CURLE_COULDNT_RESOLVE_HOST:
1178 case CURLE_COULDNT_CONNECT:
1179 case CURLE_FTP_CANT_GET_HOST:
1180 err =
"Connection failed";
1182 case CURLE_WRITE_ERROR:
1183 err =
"Write error";
1185 case CURLE_PARTIAL_FILE:
1186 case CURLE_OPERATION_TIMEDOUT:
1187 timeout_reached =
true;
1189 case CURLE_ABORTED_BY_CALLBACK:
1190 if( timeout_reached )
1192 err =
"Timeout reached";
1200 case CURLE_SSL_PEER_CERTIFICATE:
1246 string urlBuffer( curlUrl.
asString());
1247 CURLcode ret = curl_easy_setopt(
_curl, CURLOPT_URL,
1248 urlBuffer.c_str() );
1260 ret = curl_easy_setopt(
_curl, CURLOPT_NOBODY, 1L );
1262 ret = curl_easy_setopt(
_curl, CURLOPT_RANGE,
"0-1" );
1265 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1266 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL );
1272 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L );
1276 FILE *file = ::fopen(
"/dev/null",
"w" );
1278 ERR <<
"fopen failed for /dev/null" << endl;
1279 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1280 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL );
1286 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L );
1293 ret = curl_easy_setopt(
_curl, CURLOPT_WRITEDATA, file );
1297 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL );
1298 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1304 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L );
1311 CURLcode ok = curl_easy_perform(
_curl );
1312 MIL <<
"perform code: " << ok <<
" [ " << curl_easy_strerror(ok) <<
" ]" << endl;
1317 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1327 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L);
1336 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL);
1361 return ( ok == CURLE_OK );
1367 #if DETECT_DIR_INDEX 1380 bool not_a_file =
false;
1382 CURLcode ret = curl_easy_getinfo(
_curl,
1383 CURLINFO_EFFECTIVE_URL,
1385 if ( ret == CURLE_OK && ptr != NULL)
1390 std::string path( eurl.getPathName());
1391 if( !path.empty() && path !=
"/" && *path.rbegin() ==
'/')
1393 DBG <<
"Effective url (" 1395 <<
") seems to provide the index of a directory" 1414 DBG <<
"assert_dir " << dest.
dirname() <<
" failed" << endl;
1418 string destNew = target.
asString() +
".new.zypp.XXXXXX";
1419 char *buf = ::strdup( destNew.c_str());
1422 ERR <<
"out of memory for temp file name" << endl;
1427 int tmp_fd = ::mkostemp( buf, O_CLOEXEC );
1431 ERR <<
"mkstemp failed for file '" << destNew <<
"'" << endl;
1437 FILE *file = ::fdopen( tmp_fd,
"we" );
1441 ERR <<
"fopen failed for file '" << destNew <<
"'" << endl;
1445 DBG <<
"dest: " << dest << endl;
1446 DBG <<
"temp: " << destNew << endl;
1451 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
1452 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, (
long)
PathInfo(target).mtime());
1456 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
1457 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, 0L);
1467 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
1468 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, 0L);
1472 long httpReturnCode = 0;
1473 CURLcode infoRet = curl_easy_getinfo(
_curl,
1474 CURLINFO_RESPONSE_CODE,
1476 bool modified =
true;
1477 if (infoRet == CURLE_OK)
1480 if ( httpReturnCode == 304
1483 DBG <<
" Not modified.";
1490 WAR <<
"Could not get the reponse code." << endl;
1493 if (modified || infoRet != CURLE_OK)
1498 ERR <<
"Failed to chmod file " << destNew << endl;
1500 if (::fclose( file ))
1502 ERR <<
"Fclose failed for file '" << destNew <<
"'" << endl;
1506 if (
rename( destNew, dest ) != 0 ) {
1507 ERR <<
"Rename failed" << endl;
1551 string urlBuffer( curlUrl.
asString());
1552 CURLcode ret = curl_easy_setopt(
_curl, CURLOPT_URL,
1553 urlBuffer.c_str() );
1558 ret = curl_easy_setopt(
_curl, CURLOPT_WRITEDATA, file );
1567 if ( curl_easy_setopt(
_curl, CURLOPT_PROGRESSDATA, &progressData ) != 0 ) {
1568 WAR <<
"Can't set CURLOPT_PROGRESSDATA: " <<
_curlError << endl;;
1571 ret = curl_easy_perform(
_curl );
1572 #if CURLVERSION_AT_LEAST(7,19,4) 1577 if ( ftell(file) == 0 && ret == 0 )
1579 long httpReturnCode = 33;
1580 if ( curl_easy_getinfo(
_curl, CURLINFO_RESPONSE_CODE, &httpReturnCode ) == CURLE_OK && httpReturnCode == 200 )
1582 long conditionUnmet = 33;
1583 if ( curl_easy_getinfo(
_curl, CURLINFO_CONDITION_UNMET, &conditionUnmet ) == CURLE_OK && conditionUnmet )
1585 WAR <<
"TIMECONDITION unmet - retry without." << endl;
1586 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
1587 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, 0L);
1588 ret = curl_easy_perform(
_curl );
1594 if ( curl_easy_setopt(
_curl, CURLOPT_PROGRESSDATA, NULL ) != 0 ) {
1595 WAR <<
"Can't unset CURLOPT_PROGRESSDATA: " <<
_curlError << endl;;
1601 <<
", temp file size " << ftell(file)
1602 <<
" bytes." << endl;
1609 if ( progressData.fileSizeExceeded )
1620 #if DETECT_DIR_INDEX 1625 #endif // DETECT_DIR_INDEX 1635 for ( filesystem::DirContent::const_iterator it = content.begin(); it != content.end(); ++it ) {
1636 Pathname filename = dirname + it->name;
1639 switch ( it->type ) {
1646 getDir( filename, recurse_r );
1650 WAR <<
"Ignore error (" << res <<
") on creating local directory '" <<
localPath( filename ) <<
"'" << endl;
1664 const Pathname & dirname,
bool dots )
const 1672 const Pathname & dirname,
bool dots )
const 1681 ProgressData *pdata =
reinterpret_cast<ProgressData *
>( clientp );
1687 pdata->updateStats( 0.0, dlnow );
1688 return pdata->reportProgress();
1695 ProgressData *pdata =
reinterpret_cast<ProgressData *
>( clientp );
1699 long httpReturnCode = 0;
1700 if ( curl_easy_getinfo( pdata->curl, CURLINFO_RESPONSE_CODE, &httpReturnCode ) != CURLE_OK || httpReturnCode == 0 )
1701 return aliveCallback( clientp, dltotal, dlnow, ultotal, ulnow );
1703 pdata->updateStats( dltotal, dlnow );
1704 return pdata->reportProgress();
1711 ProgressData *pdata =
reinterpret_cast<ProgressData *
>(clientp);
1712 return pdata ? pdata->curl : 0;
1719 long auth_info = CURLAUTH_NONE;
1722 curl_easy_getinfo(
_curl, CURLINFO_HTTPAUTH_AVAIL, &auth_info);
1724 if(infoRet == CURLE_OK)
1738 ProgressData *data =
reinterpret_cast<ProgressData *
>(clientp);
1740 data->_expectedFileSize = expectedFileSize;
1755 if (cmcred && firstTry)
1758 DBG <<
"got stored credentials:" << endl << *credentials << endl;
1773 curlcred->setUsername(cmcred->username());
1782 curlcred->setAuthType(availAuthTypes);
1785 if (auth_report->prompt(
_url, prompt_msg, *curlcred))
1787 DBG <<
"callback answer: retry" << endl
1788 <<
"CurlAuthData: " << *curlcred << endl;
1790 if (curlcred->valid())
1792 credentials = curlcred;
1806 DBG <<
"callback answer: cancel" << endl;
1822 if (credentials->authType() == CURLAUTH_NONE)
1823 credentials->setAuthType(availAuthTypes);
1826 if (credentials->authType() != CURLAUTH_NONE)
1830 ret = curl_easy_setopt(
_curl, CURLOPT_HTTPAUTH, credentials->authType());
1836 credentials->setUrl(
_url);
std::string getScheme() const
Returns the scheme name of the URL.
void setPassword(const std::string &pass, EEncoding eflag=zypp::url::E_DECODED)
Set the password in the URL authority.
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
const Pathname & path() const
Return current Pathname.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
Flag to request encoded string(s).
Store and operate with byte count.
const char * c_str() const
String representation.
void setPathParams(const std::string ¶ms)
Set the path parameters.
pthread_once_t OnceFlag
The OnceFlag variable type.
void setUsername(const std::string &user, EEncoding eflag=zypp::url::E_DECODED)
Set the username in the URL authority.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \)
Split line_r into words.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
void setFragment(const std::string &fragment, EEncoding eflag=zypp::url::E_DECODED)
Set the fragment string in the URL.
int ZYPP_MEDIA_CURL_IPRESOLVE()
bool empty() const
Test for an empty path.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
void setPathName(const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
Set the path name.
std::string asString() const
Returns a default string representation of the Url object.
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
void callOnce(OnceFlag &flag, void(*func)())
Call once function.
std::string trim(const std::string &s, const Trim trim_r)
int unlink(const Pathname &path)
Like 'unlink'.
const std::string & asString() const
String representation.
int rename(const Pathname &oldpath, const Pathname &newpath)
Like 'rename'.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
Pathname dirname() const
Return all but the last component od this path.
std::list< DirEntry > DirContent
Returned by readdir.
bool isValid() const
Verifies the Url.
std::string numstring(char n, int w=0)
int rmdir(const Pathname &path)
Like 'rmdir'.
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
Base class for Exception.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
std::string getHost(EEncoding eflag=zypp::url::E_DECODED) const
Returns the hostname or IP from the URL authority.
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
Wrapper class for ::stat/::lstat.
mode_t applyUmaskTo(mode_t mode_r)
Modify mode_r according to the current umask ( mode_r & ~getUmask() ).
Easy-to use interface to the ZYPP dependency resolver.
void delQueryParam(const std::string ¶m)
remove the specified query parameter.
std::string getUsername(EEncoding eflag=zypp::url::E_DECODED) const
Returns the username from the URL authority.
const std::string & msg() const
Return the message string provided to the ctor.