34 #include <sys/types.h> 36 #include <sys/mount.h> 41 #define DETECT_DIR_INDEX 0 42 #define TRANSFER_TIMEOUT_MAX 60 * 60 44 #define EXPLICITLY_NO_PROXY "_none_" 46 #undef CURLVERSION_AT_LEAST 47 #define CURLVERSION_AT_LEAST(M,N,O) LIBCURL_VERSION_NUM >= ((((M)<<8)+(N))<<8)+(O) 57 extern "C" void _do_free_once()
59 curl_global_cleanup();
62 extern "C" void globalFreeOnce()
67 extern "C" void _do_init_once()
69 CURLcode ret = curl_global_init( CURL_GLOBAL_ALL );
72 WAR <<
"curl global init failed" << endl;
85 inline void globalInitOnce()
90 int log_curl(CURL *
curl, curl_infotype info,
91 char *ptr,
size_t len,
void *max_lvl)
93 if ( max_lvl ==
nullptr )
96 long maxlvl = *((
long *)max_lvl);
101 case CURLINFO_TEXT:
if ( maxlvl < 1 )
return 0; pfx =
'*';
break;
102 case CURLINFO_HEADER_IN:
if ( maxlvl < 2 )
return 0; pfx =
'<';
break;
103 case CURLINFO_HEADER_OUT:
if ( maxlvl < 2 )
return 0; pfx =
'>';
break;
108 std::vector<std::string> lines;
109 zypp::str::split( std::string(ptr,len), std::back_inserter(lines),
"\r\n" );
110 for(
const auto & line : lines )
114 if ( pos == std::string::npos )
116 DBG << pfx <<
" " << line.substr( 0, pos ) <<
" <credentials removed>" << std::endl;
119 DBG << pfx <<
" " << line << std::endl;
126 void *ptr,
size_t size,
size_t nmemb,
void *stream)
130 char * lstart = (
char *)ptr, * lend = (
char *)ptr;
132 size_t max = size * nmemb;
133 while (pos + 1 < max)
136 for (lstart = lend; *lend !=
'\n' && pos < max; ++lend, ++pos);
139 string line(lstart, lend);
140 if (line.find(
"Location") != string::npos)
142 DBG <<
"redirecting to " << line << endl;
167 inline int getZYPP_MEDIA_CURL_IPRESOLVE()
170 if (
const char * envp = getenv(
"ZYPP_MEDIA_CURL_IPRESOLVE" ) )
172 WAR <<
"env set: $ZYPP_MEDIA_CURL_IPRESOLVE='" << envp <<
"'" << endl;
173 if ( strcmp( envp,
"4" ) == 0 ) ret = 4;
174 else if ( strcmp( envp,
"6" ) == 0 ) ret = 6;
182 static int _v = getZYPP_MEDIA_CURL_IPRESOLVE();
210 callback::SendReport<DownloadProgressReport> *
report;
227 void updateStats(
double dltotal = 0.0,
double dlnow = 0.0 )
229 time_t now = _timeNow = time(0);
232 if ( dltotal && dltotal != _dnlTotal )
235 if ( dlnow && dlnow != _dnlNow )
240 else if ( !_dnlNow && !_dnlTotal )
248 if ( !_timeStart || _timeStart > now )
249 _timeStart = _timeLast = _timeRcv = now;
253 reached = ( (now -
_timeRcv) > timeout );
256 fileSizeExceeded = _expectedFileSize > 0 && _expectedFileSize < static_cast<ByteCount::SizeType>(
_dnlNow);
260 _dnlPercent = int(_dnlNow * 100 / _dnlTotal);
263 _drateTotal = _dnlNow / std::max(
int(now - _timeStart), 1 );
265 if ( _timeLast < now )
267 _drateLast = (_dnlNow -
_dnlLast) /
int(now - _timeLast);
272 else if ( _timeStart == _timeLast )
276 int reportProgress()
const 278 if ( fileSizeExceeded )
282 if ( report && !(*report)->progress( _dnlPercent, url, _drateTotal, _drateLast ) )
306 inline void escape(
string & str_r,
307 const char char_r,
const string & escaped_r ) {
309 pos != string::npos; pos = str_r.find( char_r, pos ) ) {
310 str_r.replace( pos, 1, escaped_r );
314 inline string escapedPath(
string path_r ) {
315 escape( path_r,
' ',
"%20" );
319 inline string unEscape(
string text_r ) {
320 char * tmp = curl_unescape( text_r.c_str(), 0 );
337 long num = str::strtonum<long>(param);
361 if( verify.empty() ||
367 else if( verify ==
"no")
374 std::vector<std::string> flags;
375 std::vector<std::string>::const_iterator flag;
376 str::split( verify, std::back_inserter(flags),
",");
377 for(flag = flags.begin(); flag != flags.end(); ++flag)
381 else if( *flag ==
"peer")
390 if( ! ca_path.empty())
392 if( !PathInfo(ca_path).isDir() || ! ca_path.absolute())
399 if( ! client_cert.empty())
401 if( !PathInfo(client_cert).isFile() || !client_cert.absolute())
407 if( ! client_key.empty())
409 if( !PathInfo(client_key).isFile() || !client_key.absolute())
416 if ( ! param.empty() )
428 if ( ! proxyport.empty() ) {
429 param +=
":" + proxyport;
437 if ( ! param.empty() )
449 CurlAuthData::auth_type_str2long(param);
453 DBG <<
"Rethrowing as MediaUnauthorizedException.";
461 if( !param.empty() && param ==
"no" )
478 s.
setProxy( u.asString( url::ViewOption::WITH_SCHEME + url::ViewOption::WITH_HOST + url::ViewOption::WITH_PORT ) );
491 Pathname MediaCurl::_cookieFile =
"/var/lib/YaST2/cookies";
503 static const std::string
_value(
505 "X-ZYpp-AnonymousId: %s",
506 Target::anonymousUniqueId( Pathname() ).c_str() ) )
508 return _value.c_str();
521 static const std::string
_value(
523 "X-ZYpp-DistributionFlavor: %s",
524 Target::distributionFlavor( Pathname() ).c_str() ) )
526 return _value.c_str();
539 static const std::string
_value(
541 "ZYpp %s (curl %s) %s" 543 , curl_version_info(CURLVERSION_NOW)->version
544 , Target::targetDistribution( Pathname() ).c_str()
547 return _value.c_str();
553 #define SET_OPTION(opt,val) do { \ 554 ret = curl_easy_setopt ( _curl, opt, val ); \ 556 ZYPP_THROW(MediaCurlSetOptException(_url, _curlError)); \ 560 #define SET_OPTION_OFFT(opt,val) SET_OPTION(opt,(curl_off_t)val) 561 #define SET_OPTION_LONG(opt,val) SET_OPTION(opt,(long)val) 562 #define SET_OPTION_VOID(opt,val) SET_OPTION(opt,(void*)val) 564 MediaCurl::MediaCurl(
const Url & url_r,
565 const Pathname & attach_point_hint_r )
575 MIL <<
"MediaCurl::MediaCurl(" << url_r <<
", " << attach_point_hint_r <<
")" << endl;
583 char *atemp = ::strdup( apath.asString().c_str());
585 if( !ainfo.isDir() || !ainfo.userMayRWX() ||
586 atemp == NULL || (atest=::mkdtemp(atemp)) == NULL)
588 WAR <<
"attach point " << ainfo.path()
589 <<
" is not useable for " << url_r.
getScheme() << endl;
592 else if( atest != NULL)
640 curl_version_info_data *curl_info = NULL;
641 curl_info = curl_version_info(CURLVERSION_NOW);
643 if (curl_info->protocols)
645 const char *
const *proto;
648 for(proto=curl_info->protocols; !found && *proto; ++proto)
650 if( scheme == std::string((
const char *)*proto))
655 std::string msg(
"Unsupported protocol '");
666 char *ptr = getenv(
"ZYPP_MEDIA_CURL_DEBUG");
667 _curlDebug = (ptr && *ptr) ? str::strtonum<long>( ptr) : 0L;
670 curl_easy_setopt(
_curl, CURLOPT_VERBOSE, 1L);
671 curl_easy_setopt(
_curl, CURLOPT_DEBUGFUNCTION, log_curl);
676 curl_easy_setopt(
_curl, CURLOPT_HEADERFUNCTION, log_redirects_curl);
677 CURLcode ret = curl_easy_setopt(
_curl, CURLOPT_ERRORBUFFER,
_curlError );
724 case 4:
SET_OPTION(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
break;
725 case 6:
SET_OPTION(CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
break;
749 #if CURLVERSION_AT_LEAST(7,19,4) 751 SET_OPTION( CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS );
769 #ifdef CURLSSLOPT_ALLOW_BEAST 771 ret = curl_easy_setopt(
_curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_ALLOW_BEAST );
780 SET_OPTION(CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
796 if (use_auth.empty())
797 use_auth =
"digest,basic";
799 if( auth != CURLAUTH_NONE)
801 DBG <<
"Enabling HTTP authentication methods: " << use_auth
802 <<
" (CURLOPT_HTTPAUTH=" << auth <<
")" << std::endl;
811 SET_OPTION(CURLOPT_PROXYAUTH, CURLAUTH_BASIC|CURLAUTH_DIGEST|CURLAUTH_NTLM );
821 if ( proxyuserpwd.empty() )
826 DBG <<
"Proxy: ~/.curlrc does not contain the proxy-user option" << endl;
830 DBG <<
"Proxy: using proxy-user from ~/.curlrc" << endl;
838 if ( ! proxyuserpwd.empty() )
840 SET_OPTION(CURLOPT_PROXYUSERPWD, unEscape( proxyuserpwd ).c_str());
843 #if CURLVERSION_AT_LEAST(7,19,4) 848 DBG <<
"Proxy: explicitly NOPROXY" << endl;
854 DBG <<
"Proxy: not explicitly set" << endl;
855 DBG <<
"Proxy: libcurl may look into the environment" << endl;
866 #if CURLVERSION_AT_LEAST(7,15,5) 879 MIL <<
"No cookies requested" << endl;
884 #if CURLVERSION_AT_LEAST(7,18,0) 889 for ( TransferSettings::Headers::const_iterator it = vol_settings.
headersBegin();
921 _curl = curl_easy_init();
958 curl_easy_cleanup(
_curl );
1007 doGetFileCopy(filename, target, report, expectedFileSize_r);
1074 bool timeout_reached)
const 1079 if (filename.empty())
1088 case CURLE_UNSUPPORTED_PROTOCOL:
1089 case CURLE_URL_MALFORMAT:
1090 case CURLE_URL_MALFORMAT_USER:
1093 case CURLE_LOGIN_DENIED:
1097 case CURLE_HTTP_RETURNED_ERROR:
1099 long httpReturnCode = 0;
1100 CURLcode infoRet = curl_easy_getinfo(
_curl,
1101 CURLINFO_RESPONSE_CODE,
1103 if ( infoRet == CURLE_OK )
1105 string msg =
"HTTP response: " +
str::numstring( httpReturnCode );
1106 switch ( httpReturnCode )
1112 DBG << msg <<
" Login failed (URL: " << url.
asString() <<
")" << std::endl;
1113 DBG <<
"MediaUnauthorizedException auth hint: '" << auth_hint <<
"'" << std::endl;
1128 if (url.
asString().find(
"novell.com") != string::npos)
1129 msg403 =
_(
"Visit the Novell Customer Center to check whether your registration is valid and has not expired.");
1137 DBG << msg <<
" (URL: " << url.
asString() <<
")" << std::endl;
1142 string msg =
"Unable to retrieve HTTP response:";
1143 DBG << msg <<
" (URL: " << url.
asString() <<
")" << std::endl;
1148 case CURLE_FTP_COULDNT_RETR_FILE:
1149 #if CURLVERSION_AT_LEAST(7,16,0) 1150 case CURLE_REMOTE_FILE_NOT_FOUND:
1152 case CURLE_FTP_ACCESS_DENIED:
1153 case CURLE_TFTP_NOTFOUND:
1154 err =
"File not found";
1157 case CURLE_BAD_PASSWORD_ENTERED:
1158 case CURLE_FTP_USER_PASSWORD_INCORRECT:
1159 err =
"Login failed";
1161 case CURLE_COULDNT_RESOLVE_PROXY:
1162 case CURLE_COULDNT_RESOLVE_HOST:
1163 case CURLE_COULDNT_CONNECT:
1164 case CURLE_FTP_CANT_GET_HOST:
1165 err =
"Connection failed";
1167 case CURLE_WRITE_ERROR:
1168 err =
"Write error";
1170 case CURLE_PARTIAL_FILE:
1171 case CURLE_OPERATION_TIMEDOUT:
1172 timeout_reached =
true;
1174 case CURLE_ABORTED_BY_CALLBACK:
1175 if( timeout_reached )
1177 err =
"Timeout reached";
1185 case CURLE_SSL_PEER_CERTIFICATE:
1205 DBG << filename.asString() << endl;
1230 string urlBuffer( curlUrl.
asString());
1231 CURLcode ret = curl_easy_setopt(
_curl, CURLOPT_URL,
1232 urlBuffer.c_str() );
1244 ret = curl_easy_setopt(
_curl, CURLOPT_NOBODY, 1L );
1246 ret = curl_easy_setopt(
_curl, CURLOPT_RANGE,
"0-1" );
1249 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1250 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL );
1256 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L );
1260 AutoFILE file { ::fopen(
"/dev/null",
"w" ) };
1262 ERR <<
"fopen failed for /dev/null" << endl;
1263 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1264 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL );
1270 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L );
1277 ret = curl_easy_setopt(
_curl, CURLOPT_WRITEDATA, (*file) );
1280 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL );
1281 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1287 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L );
1294 CURLcode ok = curl_easy_perform(
_curl );
1295 MIL <<
"perform code: " << ok <<
" [ " << curl_easy_strerror(ok) <<
" ]" << endl;
1300 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL );
1301 curl_easy_setopt(
_curl, CURLOPT_NOBODY, 0L);
1311 curl_easy_setopt(
_curl, CURLOPT_HTTPGET, 1L);
1320 curl_easy_setopt(
_curl, CURLOPT_RANGE, NULL);
1341 return ( ok == CURLE_OK );
1347 #if DETECT_DIR_INDEX 1360 bool not_a_file =
false;
1362 CURLcode ret = curl_easy_getinfo(
_curl,
1363 CURLINFO_EFFECTIVE_URL,
1365 if ( ret == CURLE_OK && ptr != NULL)
1371 if( !path.empty() && path !=
"/" && *path.rbegin() ==
'/')
1373 DBG <<
"Effective url (" 1375 <<
") seems to provide the index of a directory" 1391 Pathname dest = target.absolutename();
1394 DBG <<
"assert_dir " << dest.dirname() <<
" failed" << endl;
1398 ManagedFile destNew { target.extend(
".new.zypp.XXXXXX" ) };
1404 ERR <<
"out of memory for temp file name" << endl;
1408 AutoFD tmp_fd { ::mkostemp( buf, O_CLOEXEC ) };
1411 ERR <<
"mkstemp failed for file '" << destNew <<
"'" << endl;
1416 file = ::fdopen( tmp_fd,
"we" );
1419 ERR <<
"fopen failed for file '" << destNew <<
"'" << endl;
1422 tmp_fd.resetDispose();
1425 DBG <<
"dest: " << dest << endl;
1426 DBG <<
"temp: " << destNew << endl;
1431 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
1432 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, (
long)PathInfo(target).mtime());
1436 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
1437 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, 0L);
1445 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
1446 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, 0L);
1450 long httpReturnCode = 0;
1451 CURLcode infoRet = curl_easy_getinfo(
_curl,
1452 CURLINFO_RESPONSE_CODE,
1454 bool modified =
true;
1455 if (infoRet == CURLE_OK)
1458 if ( httpReturnCode == 304
1461 DBG <<
" Not modified.";
1468 WAR <<
"Could not get the reponse code." << endl;
1471 if (modified || infoRet != CURLE_OK)
1476 ERR <<
"Failed to chmod file " << destNew << endl;
1480 if ( ::fclose( file ) )
1482 ERR <<
"Fclose failed for file '" << destNew <<
"'" << endl;
1487 if (
rename( destNew, dest ) != 0 ) {
1488 ERR <<
"Rename failed" << endl;
1491 destNew.resetDispose();
1494 DBG <<
"done: " << PathInfo(dest) << endl;
1501 DBG << filename.asString() << endl;
1526 string urlBuffer( curlUrl.
asString());
1527 CURLcode ret = curl_easy_setopt(
_curl, CURLOPT_URL,
1528 urlBuffer.c_str() );
1533 ret = curl_easy_setopt(
_curl, CURLOPT_WRITEDATA, file );
1541 report->start(url, dest);
1542 if ( curl_easy_setopt(
_curl, CURLOPT_PROGRESSDATA, &progressData ) != 0 ) {
1543 WAR <<
"Can't set CURLOPT_PROGRESSDATA: " <<
_curlError << endl;;
1546 ret = curl_easy_perform(
_curl );
1547 #if CURLVERSION_AT_LEAST(7,19,4) 1552 if ( ftell(file) == 0 && ret == 0 )
1554 long httpReturnCode = 33;
1555 if ( curl_easy_getinfo(
_curl, CURLINFO_RESPONSE_CODE, &httpReturnCode ) == CURLE_OK && httpReturnCode == 200 )
1557 long conditionUnmet = 33;
1558 if ( curl_easy_getinfo(
_curl, CURLINFO_CONDITION_UNMET, &conditionUnmet ) == CURLE_OK && conditionUnmet )
1560 WAR <<
"TIMECONDITION unmet - retry without." << endl;
1561 curl_easy_setopt(
_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
1562 curl_easy_setopt(
_curl, CURLOPT_TIMEVALUE, 0L);
1563 ret = curl_easy_perform(
_curl );
1569 if ( curl_easy_setopt(
_curl, CURLOPT_PROGRESSDATA, NULL ) != 0 ) {
1570 WAR <<
"Can't unset CURLOPT_PROGRESSDATA: " <<
_curlError << endl;;
1576 <<
", temp file size " << ftell(file)
1577 <<
" bytes." << endl;
1584 if ( progressData.fileSizeExceeded )
1595 #if DETECT_DIR_INDEX 1600 #endif // DETECT_DIR_INDEX 1610 for ( filesystem::DirContent::const_iterator it = content.begin(); it != content.end(); ++it ) {
1611 Pathname filename = dirname + it->name;
1614 switch ( it->type ) {
1621 getDir( filename, recurse_r );
1625 WAR <<
"Ignore error (" << res <<
") on creating local directory '" <<
localPath( filename ) <<
"'" << endl;
1639 const Pathname & dirname,
bool dots )
const 1647 const Pathname & dirname,
bool dots )
const 1656 ProgressData *pdata =
reinterpret_cast<ProgressData *
>( clientp );
1662 pdata->updateStats( 0.0, dlnow );
1663 return pdata->reportProgress();
1670 ProgressData *pdata =
reinterpret_cast<ProgressData *
>( clientp );
1674 long httpReturnCode = 0;
1675 if ( curl_easy_getinfo( pdata->curl, CURLINFO_RESPONSE_CODE, &httpReturnCode ) != CURLE_OK || httpReturnCode == 0 )
1676 return aliveCallback( clientp, dltotal, dlnow, ultotal, ulnow );
1678 pdata->updateStats( dltotal, dlnow );
1679 return pdata->reportProgress();
1686 ProgressData *pdata =
reinterpret_cast<ProgressData *
>(clientp);
1687 return pdata ? pdata->curl : 0;
1694 long auth_info = CURLAUTH_NONE;
1697 curl_easy_getinfo(
_curl, CURLINFO_HTTPAUTH_AVAIL, &auth_info);
1699 if(infoRet == CURLE_OK)
1713 ProgressData *data =
reinterpret_cast<ProgressData *
>(clientp);
1715 data->_expectedFileSize = expectedFileSize;
1724 Target_Ptr target = zypp::getZYpp()->getTarget();
1731 if (cmcred && firstTry)
1734 DBG <<
"got stored credentials:" << endl << *credentials << endl;
1749 curlcred->setUsername(cmcred->username());
1758 curlcred->setAuthType(availAuthTypes);
1761 if (auth_report->prompt(
_url, prompt_msg, *curlcred))
1763 DBG <<
"callback answer: retry" << endl
1764 <<
"CurlAuthData: " << *curlcred << endl;
1766 if (curlcred->valid())
1768 credentials = curlcred;
1782 DBG <<
"callback answer: cancel" << endl;
1798 if (credentials->authType() == CURLAUTH_NONE)
1799 credentials->setAuthType(availAuthTypes);
1802 if (credentials->authType() != CURLAUTH_NONE)
1806 ret = curl_easy_setopt(
_curl, CURLOPT_HTTPAUTH, credentials->authType());
1812 credentials->setUrl(
_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'.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static ZConfig & instance()
Singleton ctor.
const std::string & msg() const
Return the message string provided to the ctor.
Flag to request encoded string(s).
Store and operate with byte count.
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.
std::string escape(const C_Str &str_r, const char sep_r)
Escape desired character c using a backslash.
void setPathParams(const std::string ¶ms)
Set the path parameters.
pthread_once_t OnceFlag
The OnceFlag variable type.
std::string getUsername(EEncoding eflag=zypp::url::E_DECODED) const
Returns the username from the URL authority.
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
void setUsername(const std::string &user, EEncoding eflag=zypp::url::E_DECODED)
Set the username in the URL authority.
bool isValid() const
Verifies the Url.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
AutoDispose<int> calling ::close
void setFragment(const std::string &fragment, EEncoding eflag=zypp::url::E_DECODED)
Set the fragment string in the URL.
std::string asString() const
Returns a default string representation of the Url object.
int ZYPP_MEDIA_CURL_IPRESOLVE()
#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.
int assert_file_mode(const Pathname &path, unsigned mode)
Like assert_file but enforce mode even if the file already exists.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
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'.
int rename(const Pathname &oldpath, const Pathname &newpath)
Like 'rename'.
bool startsWith(const C_Str &str_r, const C_Str &prefix_r)
alias for hasPrefix
Maintain [min,max] and counter (value) for progress counting.
std::list< DirEntry > DirContent
Returned by readdir.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
std::string numstring(char n, int w=0)
void resetDispose()
Set no dispose function.
int rmdir(const Pathname &path)
Like 'rmdir'.
Base class for Exception.
bool strToBool(const C_Str &str, bool default_r)
Parse str into a bool depending on the default value.
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
AutoDispose<FILE*> calling ::fclose
mode_t applyUmaskTo(mode_t mode_r)
Modify mode_r according to the current umask ( mode_r & ~getUmask() ).
std::string getScheme() const
Returns the scheme name of the URL.
Easy-to use interface to the ZYPP dependency resolver.
std::string getPassword(EEncoding eflag=zypp::url::E_DECODED) const
Returns the password from the URL authority.
void delQueryParam(const std::string ¶m)
remove the specified query parameter.