libzypp: zypp/media/MediaCurl2.cc Source File

libzypp 17.38.6

MediaCurl2.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12
13#include <iostream>
14
15#include <zypp-core/base/Logger.h>
16#include <zypp-core/ExternalProgram.h>
17#include <zypp-core/base/String.h>
18#include <zypp-core/base/Gettext.h>
19#include <zypp-core/parser/Sysconfig>
20
21#include <zypp/media/MediaCurl2.h>
22
23#include <zypp-core/ng/base/private/linuxhelpers_p.h>
24#include <zypp-core/base/userrequestexception.h>
25#include <zypp-curl/ProxyInfo>
26#include <zypp-curl/CurlConfig>
27#include <zypp-curl/private/curlhelper_p.h>
28#include <zypp/Target.h>
29#include <zypp/ZYppFactory.h>
30#include <zypp/ZConfig.h>
31#include <zypp/zypp_detail/ZYppImpl.h> // for zypp_poll
32
33#include <zypp-curl/ng/network/networkrequestdispatcher.h>
34#include <zypp-curl/ng/network/request.h>
35
36#include <cstdlib>
37#include <sys/types.h>
38#include <sys/stat.h>
39#include <sys/mount.h>
40#include <dirent.h>
41#include <unistd.h>
42#include <glib.h>
43
44#include "detail/MediaNetworkRequestExecutor.h"
45#include "detail/OptionalDownloadProgressReport.h"
46#include <zypp-curl/ng/network/private/mediadebug_p.h>
47
48#ifdef ENABLE_ZCHUNK_COMPRESSION
49#include <zypp-curl/ng/network/zckhelper.h>
50#endif
51
52
58
59using std::endl;
60
61using namespace internal;
62using namespace zypp::base;
63
64namespace zypp {
65
66 namespace media {
67
68 MediaCurl2::MediaCurl2(const MirroredOrigin origin_r,
69 const Pathname & attach_point_hint_r )
70 : MediaNetworkCommonHandler( origin_r, attach_point_hint_r,
71 "/", // urlpath at attachpoint
72 true ) // does_download
73 , _executor( std::make_shared<internal::MediaNetworkRequestExecutor>() )
74 {
75
76 MIL << "MediaCurl2::MediaCurl2(" << origin_r.authority().url() << ", " << attach_point_hint_r << ")" << endl;
77
78 if( !attachPoint().empty())
79 {
80 PathInfo ainfo(attachPoint());
81 Pathname apath(attachPoint() + "XXXXXX");
82 char *atemp = ::strdup( apath.asString().c_str());
83 char *atest = NULL;
84 if( !ainfo.isDir() || !ainfo.userMayRWX() ||
85 atemp == NULL || (atest=::mkdtemp(atemp)) == NULL)
86 {
87 WAR << "attach point " << ainfo.path()
88 << " is not useable for " << origin_r.authority().url().getScheme() << endl;
89 setAttachPoint("", true);
90 }
91 else if( atest != NULL)
92 ::rmdir(atest);
93
94 if( atemp != NULL)
95 ::free(atemp);
96 }
97 }
98
100
101 void MediaCurl2::checkProtocol(const Url &url) const
102 {
103 if ( !zyppng::NetworkRequestDispatcher::supportsProtocol ( url ) )
104 {
105 std::string msg("Unsupported protocol '");
106 msg += url.getScheme();
107 msg += "'";
108 ZYPP_THROW(MediaBadUrlException(url, msg));
109 }
110 }
111
112 void MediaCurl2::disconnectFrom()
113 {
114 // clear effective settings
115 clearTransferSettings();
116 }
117
119
120 void MediaCurl2::releaseFrom( const std::string & ejectDev )
121 {
122 disconnect();
123 }
124
126
127 void MediaCurl2::getFileCopy( const OnMediaLocation & srcFile , const Pathname & target ) const
128 {
129
130 const auto &filename = srcFile.filename();
131
132 // Optional files will send no report until data are actually received (we know it exists).
133 OptionalDownloadProgressReport reportfilter( srcFile.optional() );
134 callback::SendReport<DownloadProgressReport> report;
135
136 const auto &mirrOrder = mirrorOrder (srcFile);
137 for ( unsigned mirr : mirrOrder ) {
138 MIL << "Trying to fetch file " << srcFile << " via URL: " << _origin[mirr].url() << std::endl;
139 Url fileurl(getFileUrl(mirr, filename));
140
141 try
142 {
143 const auto &myOrigin = _origin[mirr];
144 if(!myOrigin.url().isValid())
145 ZYPP_THROW(MediaBadUrlException(myOrigin.url()));
146
147 if(myOrigin.url().getHost().empty())
148 ZYPP_THROW(MediaBadUrlEmptyHostException(myOrigin.url()));
149
150
151 Pathname dest = target.absolutename();
152 if( assert_dir( dest.dirname() ) ) {
153 DBG << "assert_dir " << dest.dirname() << " failed" << endl;
154 ZYPP_THROW( MediaSystemException(fileurl, "System error on " + dest.dirname().asString()) );
155 }
156
157 ManagedFile destNew { target.extend( ".new.zypp.XXXXXX" ) }; {
158 AutoFREE<char> buf { ::strdup( (*destNew).c_str() ) };
159 if( ! buf ) {
160 ERR << "out of memory for temp file name" << endl;
161 ZYPP_THROW(MediaSystemException(fileurl, "out of memory for temp file name"));
162 }
163
164 AutoFD tmp_fd { ::mkostemp( buf, O_CLOEXEC ) };
165 if( tmp_fd == -1 ) {
166 ERR << "mkstemp failed for file '" << destNew << "'" << endl;
167 ZYPP_THROW(MediaWriteException(destNew));
168 }
169 destNew = ManagedFile( (*buf), filesystem::unlink );
170 }
171
172 DBG << "dest: " << dest << endl;
173 DBG << "temp: " << destNew << endl;
174 #if 0
175 Not implemented here yet because NetworkRequest can not do IFMODSINCE yet
176 // set IFMODSINCE time condition (no download if not modified)
177 if( PathInfo(target).isExist() && !(options & OPTION_NO_IFMODSINCE) )
178 {
179 curl_easy_setopt(_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
180 curl_easy_setopt(_curl, CURLOPT_TIMEVALUE, (long)PathInfo(target).mtime());
181 }
182 else
183 {
184 curl_easy_setopt(_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
185 curl_easy_setopt(_curl, CURLOPT_TIMEVALUE, 0L);
186 }
187 #endif
188
189 DBG << srcFile.filename().asString() << endl;
190 DBG << "URL: " << fileurl.asString() << endl;
191
192 // Use URL without options and without username and passwd
193 // (some proxies dislike them in the URL).
194 // Curl seems to need the just scheme, hostname and a path;
195 // the rest was already passed as curl options (in attachTo).
196 Url curlUrl( clearQueryString(fileurl) );
197
198 RequestData r;
199 r._mirrorIdx = mirr;
200 r._req = std::make_shared<zyppng::NetworkRequest>( curlUrl, destNew, zyppng::NetworkRequest::WriteShared /*do not truncate*/ );
201 r._req->transferSettings() = myOrigin.getConfig<TransferSettings>( MIRR_SETTINGS_KEY.data() );
202 r._req->setExpectedFileSize ( srcFile.downloadSize () );
203
204 bool done = false;
205 #ifdef ENABLE_ZCHUNK_COMPRESSION
206 done = const_cast<MediaCurl2*>(this)->tryZchunk(r, srcFile, destNew, report);
207 #endif
208 if ( !done ) {
209 r._req->resetRequestRanges();
210 const_cast<MediaCurl2 *>(this)->executeRequest ( r, &report );
211 }
212
213 #if 0
214 Also disabled IFMODSINCE code, see above while not yet implemented here
215 #if CURLVERSION_AT_LEAST(7,19,4)
216 // bnc#692260: If the client sends a request with an If-Modified-Since header
217 // with a future date for the server, the server may respond 200 sending a
218 // zero size file.
219 // curl-7.19.4 introduces CURLINFO_CONDITION_UNMET to check this condition.
220 if ( ftell(file) == 0 && ret == 0 )
221 {
222 long httpReturnCode = 33;
223 if ( curl_easy_getinfo( _curl, CURLINFO_RESPONSE_CODE, &httpReturnCode ) == CURLE_OK && httpReturnCode == 200 )
224 {
225 long conditionUnmet = 33;
226 if ( curl_easy_getinfo( _curl, CURLINFO_CONDITION_UNMET, &conditionUnmet ) == CURLE_OK && conditionUnmet )
227 {
228 WAR << "TIMECONDITION unmet - retry without." << endl;
229 curl_easy_setopt(_curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_NONE);
230 curl_easy_setopt(_curl, CURLOPT_TIMEVALUE, 0L);
231 ret = executeCurl();
232 }
233 }
234 }
235 #endif
236 #endif
237
238
239 // apply umask
240 if ( ::chmod( destNew->c_str(), filesystem::applyUmaskTo( 0644 ) ) )
241 {
242 ERR << "Failed to chmod file " << destNew << endl;
243 }
244
245 // move the temp file into dest
246 if ( rename( destNew, dest ) != 0 ) {
247 ERR << "Rename failed" << endl;
248 ZYPP_THROW(MediaWriteException(dest));
249 }
250 destNew.resetDispose(); // no more need to unlink it
251
252 DBG << "done: " << PathInfo(dest) << endl;
253
254 break; // success!
255 }
256 catch (MediaException & excpt_r)
257 {
258 // check if we can retry on the next mirror
259 if( !canTryNextMirror ( excpt_r ) || ( mirr == mirrOrder.back() ) ) {
260 // rewrite the exception to contain the correct pathname and url
261 // the executeRequest implementation just emits the full Url in the exception
262 if ( typeid(excpt_r) == typeid( MediaFileNotFoundException ) ) {
263 ZYPP_CAUGHT(excpt_r);
264 ZYPP_THROW( MediaFileNotFoundException( url(), filename ) );
265 }
266 ZYPP_RETHROW(excpt_r);
267 }
268
269 this->deprioritizeMirror( mirr );
270
271 ZYPP_CAUGHT(excpt_r);
272 continue;
273 }
274 }
275 }
276
277 bool MediaCurl2::getDoesFileExist( const Pathname & filename ) const
278 {
279 DBG << filename.asString() << endl;
280
281 std::exception_ptr lastErr;
282 MIL << "Trying origin: " << _origin << std::endl;
283 for ( unsigned mirr : mirrorOrder( OnMediaLocation( filename ).setMirrorsAllowed(false) )) {
284
285 const auto &myEndpoint = _origin[mirr];
286
287 if( !myEndpoint.url().isValid() )
288 ZYPP_THROW(MediaBadUrlException(myEndpoint.url()));
289
290 if( _origin[mirr].url().getHost().empty() )
291 ZYPP_THROW(MediaBadUrlEmptyHostException(myEndpoint.url()));
292
293 Url url(getFileUrl(mirr, filename));
294
295 DBG << "URL: " << url.asString() << endl;
296
297 // Use URL without options and without username and passwd
298 // (some proxies dislike them in the URL).
299 // Curl seems to need the just scheme, hostname and a path;
300 // the rest was already passed as curl options (in attachTo).
301 Url curlUrl( clearQueryString(url) );
302
303 RequestData r;
304 r._mirrorIdx = mirr;
305 r._req = std::make_shared<zyppng::NetworkRequest>( curlUrl, "/dev/null" );
306 r._req->setOptions ( zyppng::NetworkRequest::HeadRequest ); // just check for existance
307 r._req->transferSettings() = myEndpoint.getConfig<TransferSettings>(MIRR_SETTINGS_KEY.data());
308
309 // as we are not having user interaction, the user can't cancel
310 // the file existence checking, a callback or timeout return code
311 // will be always a timeout.
312 try {
313 const_cast<MediaCurl2*>(this)->executeRequest ( r );
314
315 } catch ( const MediaFileNotFoundException &e ) {
316 // if the file did not exist then we can return false
317 return false;
318 } catch ( const MediaException &e ) {
319 // check if we can retry on the next mirror
320 lastErr = ZYPP_FWD_CURRENT_EXCPT();
321 if( !canTryNextMirror ( e ) ) {
322 break;
323 }
324
325 this->deprioritizeMirror( mirr );
326
327 continue;
328 }
329 // exists
330 return ( !r._req->hasError() );
331 }
332
333 if ( lastErr ) {
334 try {
335 ZYPP_RETHROW (lastErr);
336 } catch ( const MediaFileNotFoundException &e ) {
337 // if the file did not exist then we can return false
338 return false;
339 }
340 }
341 // we probably never had mirrors, otherwise we either had an error or a success.
342 return false;
343 }
344
345 bool MediaCurl2::tryZchunk( RequestData &reqData, const OnMediaLocation &srcFile, const Pathname &target, callback::SendReport<DownloadProgressReport> &report )
346 {
347#ifdef ENABLE_ZCHUNK_COMPRESSION
348
349 // HERE add zchunk logic if required
350 if ( !srcFile.deltafile().empty()
351 && zyppng::ZckLoader::isZchunkFile (srcFile.deltafile ()) ) {
352
353 zyppng::Ref<zyppng::ZckLoader> zckHelper = std::make_shared<zyppng::ZckLoader>();
354
355 const auto &fetchChunks = [&]( const std::vector<zyppng::ZckLoader::Block> &blocks ){
356
357 reqData._req->resetRequestRanges();
358
359 for ( const auto &block : blocks ) {
360 if ( block._checksum.size() && block._chksumtype.size() ) {
361 std::optional<zypp::Digest> dig = zypp::Digest();
362 if ( !dig->create( block._chksumtype ) ) {
363 WAR_MEDIA << "Trying to create Digest with chksum type " << block._chksumtype << " failed " << std::endl;
364 zckHelper->setFailed( str::Str() << "Trying to create Digest with chksum type " << block._chksumtype << " failed " );
365 return;
366 }
367
368 if ( zypp::env::ZYPP_MEDIA_CURL_DEBUG() > 3 )
369 DBG_MEDIA << "Starting block " << block._start << " with checksum " << zypp::Digest::digestVectorToString( block._checksum ) << "." << std::endl;
370 reqData._req->addRequestRange( block._start, block._len, std::move(dig), block._checksum, {}, block._relevantDigestLen, block._chksumPad );
371 } else {
372 if ( zypp::env::ZYPP_MEDIA_CURL_DEBUG() > 3 )
373 DBG_MEDIA << "Starting block " << block._start << " without checksum!" << std::endl;
374 reqData._req->addRequestRange( block._start, block._len );
375 }
376 };
377
378 executeRequest ( reqData, &report );
379 zckHelper->cont().unwrap();
380 };
381
382
383 zyppng::ZckLoader::PrepareResult res;
384 const auto &fin = [&]( zyppng::ZckLoader::PrepareResult result ){
385 res = std::move(result);
386 };
387
388 const auto &hdrSize = srcFile.headerSize();
389 const auto &dSize = srcFile.downloadSize();
390 zckHelper->connectFunc( &zyppng::ZckLoader::sigBlocksRequired, fetchChunks );
391 zckHelper->connectFunc( &zyppng::ZckLoader::sigFinished, fin );
392 zckHelper->buildZchunkFile( target, srcFile.deltafile(), dSize ? dSize : std::optional<zypp::ByteCount>{}, hdrSize ? hdrSize : std::optional<zypp::ByteCount>{} ).unwrap();
393
394 switch(res._code) {
395 case zyppng::ZckLoader::PrepareResult::Error: {
396 ERR << "Failed to setup zchunk because of: " << res._message << std::endl;
397 return false;
398 }
399 case zyppng::ZckLoader::PrepareResult::ExceedsMaxLen:
400 ZYPP_THROW( MediaFileSizeExceededException( reqData._req->url(), srcFile.downloadSize(), res._message ));
401 case zyppng::ZckLoader::PrepareResult::Success:
402 case zyppng::ZckLoader::PrepareResult::NothingToDo:
403 return true; //done
404 }
405 }
406#endif
407 return false;
408 }
409
410 void MediaCurl2::executeRequest( MediaCurl2::RequestData &reqData , callback::SendReport<DownloadProgressReport> *report )
411 {
412 const auto &authCb = [&]( const zypp::Url &, TransferSettings &settings, const std::string & availAuthTypes, bool firstTry, bool &canContinue ) {
413 auto &originEndpoint = _origin[reqData._mirrorIdx];
414 auto &epSettings = originEndpoint.getConfig<TransferSettings>(MIRR_SETTINGS_KEY.data());
415 if ( authenticate( _origin[reqData._mirrorIdx].url(), epSettings, availAuthTypes, firstTry ) ) {
416 settings = epSettings;
417 canContinue = true;
418 return;
419 }
420 canContinue = false;
421 };
422
423 auto conn = _executor->sigAuthRequired().connect (authCb);
424 zypp_defer {
425 conn.disconnect ();
426 };
427
428 _executor->executeRequest ( reqData._req, report );
429 }
430 } // namespace media
431} // namespace zypp
432//
zypp_defer
#define zypp_defer
Definition AutoDispose.h:293
ZYPP_RETHROW
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
Definition Exception.h:479
ZYPP_CAUGHT
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Definition Exception.h:475
ZYPP_FWD_CURRENT_EXCPT
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.
Definition Exception.h:471
ZYPP_THROW
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition Exception.h:459
ExternalProgram.h
Gettext.h
Logger.h
DBG
#define DBG
Definition Logger.h:102
MIL
#define MIL
Definition Logger.h:103
ERR
#define ERR
Definition Logger.h:105
WAR
#define WAR
Definition Logger.h:104
MediaCurl2.h
MediaNetworkRequestExecutor.h
OptionalDownloadProgressReport.h
String.h
Target.h
ZConfig.h
ZYppFactory.h
ZYppImpl.h
zypp::AutoDispose::resetDispose
void resetDispose()
Set no dispose function.
Definition AutoDispose.h:171
zypp::Digest
Compute Message Digests (MD5, SHA1 etc).
Definition Digest.h:38
zypp::Digest::digestVectorToString
static std::string digestVectorToString(const UByteArray &vec)
get hex string representation of the digest vector given as parameter
Definition Digest.cc:244
zypp::MirroredOrigin
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Definition MirroredOrigin.h:170
zypp::MirroredOrigin::authority
const OriginEndpoint & authority() const
Definition MirroredOrigin.cc:205
zypp::OnMediaLocation
Describes a resource file located on a medium.
Definition onmedialocation.h:37
zypp::OnMediaLocation::optional
bool optional() const
Whether this is an optional resource.
Definition onmedialocation.cc:111
zypp::OnMediaLocation::downloadSize
const ByteCount & downloadSize() const
The size of the resource on the server.
Definition onmedialocation.cc:117
zypp::OnMediaLocation::filename
const Pathname & filename() const
The path to the resource on the medium.
Definition onmedialocation.cc:90
zypp::OnMediaLocation::deltafile
const Pathname & deltafile() const
The existing deltafile that can be used to reduce download size ( zchunk or metalink ).
Definition onmedialocation.cc:153
zypp::OnMediaLocation::headerSize
const ByteCount & headerSize() const
The size of the header prepending the resource (e.g.
Definition onmedialocation.cc:141
zypp::OriginEndpoint::url
const zypp::Url & url() const
Definition MirroredOrigin.cc:53
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::Url::getScheme
std::string getScheme() const
Returns the scheme name of the URL.
Definition Url.cc:560
zypp::Url::asString
std::string asString() const
Returns a default string representation of the Url object.
Definition Url.cc:524
zypp::filesystem::PathInfo
Wrapper class for stat/lstat.
Definition PathInfo.h:226
zypp::filesystem::PathInfo::userMayRWX
bool userMayRWX() const
Definition PathInfo.h:361
zypp::filesystem::PathInfo::path
const Pathname & path() const
Return current Pathname.
Definition PathInfo.h:251
zypp::filesystem::PathInfo::isDir
bool isDir() const
Definition PathInfo.h:296
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:48
zypp::filesystem::Pathname::dirname
Pathname dirname() const
Return all but the last component od this path.
Definition Pathname.h:133
zypp::filesystem::Pathname::c_str
const char * c_str() const
String representation.
Definition Pathname.h:113
zypp::filesystem::Pathname::asString
const std::string & asString() const
String representation.
Definition Pathname.h:94
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition Pathname.h:117
zypp::media::MediaBadUrlEmptyHostException
Definition mediaexception.h:308
zypp::media::MediaBadUrlException
Definition mediaexception.h:292
zypp::media::MediaCurl2::releaseFrom
void releaseFrom(const std::string &ejectDev) override
Call concrete handler to release the media.
Definition MediaCurl2.cc:120
zypp::media::MediaCurl2::disconnectFrom
void disconnectFrom() override
Definition MediaCurl2.cc:112
zypp::media::MediaCurl2::getFileCopy
void getFileCopy(const OnMediaLocation &srcFile, const Pathname &targetFilename) const override
Definition MediaCurl2.cc:127
zypp::media::MediaCurl2::MediaCurl2
MediaCurl2(const MirroredOrigin origin_r, const Pathname &attach_point_hint_r)
Definition MediaCurl2.cc:68
zypp::media::MediaCurl2::getDoesFileExist
bool getDoesFileExist(const Pathname &filename) const override
Repeatedly calls doGetDoesFileExist() until it successfully returns, fails unexpectedly,...
Definition MediaCurl2.cc:277
zypp::media::MediaCurl2::executeRequest
void executeRequest(RequestData &reqData, callback::SendReport< DownloadProgressReport > *report=nullptr)
Definition MediaCurl2.cc:410
zypp::media::MediaCurl2::_executor
internal::MediaNetworkRequestExecutorRef _executor
Definition MediaCurl2.h:102
zypp::media::MediaCurl2::tryZchunk
bool tryZchunk(RequestData &reqData, const OnMediaLocation &srcFile, const Pathname &target, callback::SendReport< DownloadProgressReport > &report)
Definition MediaCurl2.cc:345
zypp::media::MediaCurl2::checkProtocol
void checkProtocol(const Url &url) const override
check the url is supported by the curl library
Definition MediaCurl2.cc:101
zypp::media::MediaException
Just inherits Exception to separate media exceptions.
Definition mediaexception.h:37
zypp::media::MediaFileNotFoundException
Definition mediaexception.h:164
zypp::media::MediaFileSizeExceededException
Definition mediaexception.h:513
zypp::media::MediaHandler::_origin
MirroredOrigin _origin
Contains the authority URL and mirrors.
Definition MediaHandler.h:112
zypp::media::MediaHandler::url
Url url() const
Primary Url used.
Definition MediaHandler.h:507
zypp::media::MediaHandler::disconnect
void disconnect()
Use concrete handler to isconnect media.
Definition MediaHandler.cc:687
zypp::media::MediaHandler::originEndpoint
OriginEndpoint originEndpoint() const
Primary OriginEndpoint used.
Definition MediaHandler.h:512
zypp::media::MediaHandler::setAttachPoint
void setAttachPoint(const Pathname &path, bool temp)
Set a new attach point.
Definition MediaHandler.cc:200
zypp::media::MediaHandler::attachPoint
Pathname attachPoint() const
Return the currently used attach point.
Definition MediaHandler.cc:185
zypp::media::MediaNetworkCommonHandler::clearTransferSettings
void clearTransferSettings()
Definition MediaNetworkCommonHandler.cc:314
zypp::media::MediaNetworkCommonHandler::authenticate
bool authenticate(const Url &url, TransferSettings &settings, const std::string &availAuthTypes, bool firstTry)
Definition MediaNetworkCommonHandler.cc:322
zypp::media::MediaNetworkCommonHandler::canTryNextMirror
static bool canTryNextMirror(const Excpt &excpt_r)
Definition MediaNetworkCommonHandler.h:108
zypp::media::MediaNetworkCommonHandler::deprioritizeMirror
void deprioritizeMirror(unsigned mirr) const
Move mirror index mirr to the end of the attempt list.
Definition MediaNetworkCommonHandler.cc:348
zypp::media::MediaNetworkCommonHandler::mirrorOrder
std::vector< unsigned > mirrorOrder(const OnMediaLocation &loc) const
Definition MediaNetworkCommonHandler.cc:329
zypp::media::MediaNetworkCommonHandler::clearQueryString
Url clearQueryString(const Url &url) const
Definition MediaNetworkCommonHandler.cc:73
zypp::media::MediaNetworkCommonHandler::getFileUrl
Url getFileUrl(int mirrorIdx, const Pathname &filename) const
concatenate the attach url and the filename to a complete download url
Definition MediaNetworkCommonHandler.cc:209
zypp::media::MediaNetworkCommonHandler::MediaNetworkCommonHandler
MediaNetworkCommonHandler(const MirroredOrigin &origin_r, const Pathname &attach_point_r, const Pathname &urlpath_below_attachpoint_r, const bool does_download_r)
Definition MediaNetworkCommonHandler.cc:36
zypp::media::MediaNetworkCommonHandler::MIRR_SETTINGS_KEY
static constexpr std::string_view MIRR_SETTINGS_KEY
Definition MediaNetworkCommonHandler.h:37
zypp::media::MediaSystemException
Definition mediaexception.h:241
zypp::media::MediaWriteException
Definition mediaexception.h:185
zypp::media::TransferSettings
Holds transfer setting.
Definition transfersettings.h:34
zyppng::NetworkRequest::HeadRequest
@ HeadRequest
Definition request.h:71
zyppng::NetworkRequest::WriteShared
@ WriteShared
Definition request.h:66
zyppng::ZckLoader::sigFinished
SignalProxy< void(PrepareResult)> sigFinished()
Called once the zchunk build process is finished, either with error or success.
Definition zckhelper.cc:299
zyppng::ZckLoader::isZchunkFile
static bool isZchunkFile(const zypp::Pathname &file)
Definition zckhelper.cc:309
zyppng::ZckLoader::sigBlocksRequired
SignalProxy< void(const std::vector< Block > &)> sigBlocksRequired()
Signal to notify the caller about required blocks, once the blocks are downloaded call cont to contin...
Definition zckhelper.cc:294
curlhelper_p.h
linuxhelpers_p.h
mediadebug_p.h
WAR_MEDIA
#define WAR_MEDIA
Definition mediadebug_p.h:30
DBG_MEDIA
#define DBG_MEDIA
Definition mediadebug_p.h:28
internal
Definition OptionalDownloadProgressReport.cc:12
std
Definition ansi.h:855
zypp::base
Definition Random.cc:7
zypp::env::ZYPP_MEDIA_CURL_DEBUG
const long & ZYPP_MEDIA_CURL_DEBUG()
const long& for setting CURLOPT_DEBUGDATA Returns a reference to a static variable,...
Definition curlhelper.cc:36
zypp::filesystem::applyUmaskTo
mode_t applyUmaskTo(mode_t mode_r)
Modify mode_r according to the current umask ( mode_r & ~getUmask() ).
Definition PathInfo.h:813
zypp::filesystem::unlink
int unlink(const Pathname &path)
Like 'unlink'.
Definition PathInfo.cc:719
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp::target
Definition KeyRing.h:325
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::ManagedFile
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
Definition ManagedFile.h:27
zyppng::Ref
std::shared_ptr< T > Ref
Definition zyppglobal.h:103
networkrequestdispatcher.h
request.h
internal::OptionalDownloadProgressReport
Bottleneck filtering all DownloadProgressReport issued from Media[Muli]Curl.
Definition OptionalDownloadProgressReport.h:22
zypp::AutoFD
AutoDispose<int> calling close
Definition AutoDispose.h:310
zypp::AutoFREE
Definition AutoDispose.h:332
zypp::callback::SendReport
Definition Callback.h:237
zypp::media::MediaCurl2::RequestData
Definition MediaCurl2.h:93
zypp::media::MediaCurl2::RequestData::_req
zyppng::NetworkRequestRef _req
Definition MediaCurl2.h:95
zypp::media::MediaCurl2::RequestData::_mirrorIdx
int _mirrorIdx
Definition MediaCurl2.h:94
zypp::str::Str
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
Definition String.h:213
zyppng::ZckLoader::PrepareResult
Definition zckhelper.h:51
zyppng::ZckLoader::PrepareResult::ExceedsMaxLen
@ ExceedsMaxLen
Definition zckhelper.h:55
zyppng::ZckLoader::PrepareResult::Error
@ Error
Definition zckhelper.h:53
zyppng::ZckLoader::PrepareResult::Success
@ Success
Definition zckhelper.h:56
zyppng::ZckLoader::PrepareResult::NothingToDo
@ NothingToDo
Definition zckhelper.h:54
zyppng::ZckLoader::PrepareResult::_code
Code _code
Definition zckhelper.h:59
zyppng::ZckLoader::PrepareResult::_message
std::string _message
Definition zckhelper.h:62
userrequestexception.h
zckhelper.h