14#include <zypp-curl/TransferSettings>
16#include <zypp-media/MediaException>
23 , _requestDispatcher (
std::move(requestDispatcher) )
25 , _spec(
std::move(spec) )
39 MIL <<
"Authentication failed for " << req->url() <<
" trying to recover." << std::endl;
43 ts.setUsername(
auth->username() );
44 ts.setPassword(
auth->password() );
54 ts.setAuthType(
nwCred->authTypeAsString());
62 - zypp::url::ViewOption::WITH_USERNAME
63 - zypp::url::ViewOption::WITH_PASSWORD
64 - zypp::url::ViewOption::WITH_QUERY_STR;
70 MIL <<
"Found a credential match in the cache!" << std::endl;
78 credFromUser->setLastDatabaseUpdate ( req->_authTimestamp );
96#if ENABLE_ZCHUNK_COMPRESSION
97 bool DownloadPrivateBase::hasZckInfo()
const
157 std::map<std::string, boost::any> extraInfo;
158 extraInfo.insert( {
"requestUrl", url } );
177 if ( set.authType() ==
"basic"
178 && set.username().size()
179 && !set.password().size() ) {
181 const auto cred =
cm.getCred( url );
183 if ( !set.username().size() )
184 set.setUsername(
cred->username());
185 set.setPassword(
cred->password());
214 const auto &
s =
d_func()->currentState();
236 if (!
lReq.isError() ) {
252 if ( !
d->_requestDispatcher )
258 d->visitState( [](
auto &
s ){
260 if constexpr ( std::is_same_v<T, DlMetalinkState>
261#if ENABLE_ZCHUNK_COMPRESSION
262 || std::is_same_v<T, DLZckState>
278 d_func()->_stopOnMetalink = set;
283 return d_func()->_stoppedOnMetalink;
298 return d_func()->_lastTriedAuthTime;
303 return *
d_func()->_requestDispatcher;
308 return d_func()->_sigStarted;
313 return d_func()->DownloadPrivateBase::_sigStateChanged;
318 return d_func()->_sigAlive;
323 return d_func()->_sigProgress;
328 return d_func()->DownloadPrivateBase::_sigFinished;
333 return d_func()->_sigAuthRequired;
338 , _mirrors(
std::move(
mc) )
356 return dl.get() == &download;
383 while (
d->_runningDownloads.size() ) {
384 d->_runningDownloads.back()->cancel();
385 d->_runningDownloads.pop_back();
394 d->_runningDownloads.push_back(
dl );
396 d->_requestDispatcher->run();
403 return d_func()->_requestDispatcher;
408 return d_func()->_sigStarted;
413 return d_func()->_sigFinished;
418 return d_func()->_queueEmpty;
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Base class for Exception.
static auto connectFunc(typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers)
time_t _lastTriedAuthTime
NetworkRequestError safeFillSettingsFromURL(const Url &url, TransferSettings &set)
~DownloadPrivateBase() override
Signal< void(Download &req) _sigFinished)
zypp::media::CredentialManager::CredentialSet _credCache
bool handleRequestAuthError(const std::shared_ptr< Request > &req, const zyppng::NetworkRequestError &err)
zypp::TriBool _specHasZckInfo
Signal< void(zyppng::Download &req, zyppng::NetworkAuthData &auth, const std::string &availAuth) _sigAuthRequired)
Signal< void(Download &req, Download::State state) _sigStateChanged)
DownloadPrivateBase(Downloader &parent, std::shared_ptr< NetworkRequestDispatcher > requestDispatcher, std::shared_ptr< MirrorControl > mirrors, DownloadSpec &&spec, Download &p)
DownloadPrivate(Downloader &parent, std::shared_ptr< NetworkRequestDispatcher > requestDispatcher, std::shared_ptr< MirrorControl > mirrors, DownloadSpec &&spec, Download &p)
const TransferSettings & settings() const
zypp::ByteCount headerSize() const
zypp::filesystem::Pathname deltaFile() const
const zypp::Pathname & targetPath() const
std::string errorString() const
void setStopOnMetalink(const bool set=true)
NetworkRequestDispatcher & dispatcher() const
SignalProxy< void(Download &req, NetworkAuthData &auth, const std::string &availAuth) sigAuthRequired)()
SignalProxy< void(Download &req, off_t dltotal, off_t dlnow) sigProgress)()
SignalProxy< void(Download &req, State state) sigStateChanged)()
NetworkRequestError lastRequestError() const
SignalProxy< void(Download &req, off_t dlnow) sigAlive)()
uint64_t lastAuthTimestamp() const
SignalProxy< void(Download &req) sigFinished)()
Download(Downloader &parent, std::shared_ptr< NetworkRequestDispatcher > requestDispatcher, std::shared_ptr< MirrorControl > mirrors, DownloadSpec &&spec)
bool stoppedOnMetalink() const
SignalProxy< void(Download &req) sigStarted)()
std::shared_ptr< MirrorControl > _mirrors
std::vector< std::shared_ptr< Download > > _runningDownloads
void onDownloadFinished(Download &download)
std::shared_ptr< NetworkRequestDispatcher > _requestDispatcher
Signal< void(Downloader &parent, Download &download) _sigFinished)
Signal< void(Downloader &parent, Download &download) _sigStarted)
void onDownloadStarted(Download &download)
Signal< void(Downloader &parent) _queueEmpty)
DownloaderPrivate(std::shared_ptr< MirrorControl > mc, Downloader &p)
SignalProxy< void(Downloader &parent, Download &download) sigStarted)()
SignalProxy< void(Downloader &parent, Download &download) sigFinished)()
std::shared_ptr< Download > downloadFile(const DownloadSpec &spec)
std::shared_ptr< NetworkRequestDispatcher > requestDispatcher() const
SignalProxy< void(Downloader &parent) queueEmpty)()
static zyppng::NetworkRequestError customError(NetworkRequestError::Type t, std::string &&errorMsg="", std::map< std::string, boost::any > &&extraInfo={})
The NetworkRequestError class Represents a error that occured in.
T extraInfoValue(const std::string &key, T &&defaultVal=T()) const
Type type() const
type Returns the type of the error
bool isError() const
isError Will return true if this is a actual error
This defines the actual StateMachine.
std::optional< StateId > currentState() const
std::shared_ptr< T > state()
void fillSettingsFromUrl(const Url &url, media::TransferSettings &s)
Fills the settings structure using options passed on the url for example ?timeout=x&proxy=foo.
void fillSettingsSystemProxy(const Url &url, media::TransferSettings &s)
Reads the system proxy configuration and fills the settings structure proxy information.
typename decay< T >::type decay_t
zypp::media::CurlAuthData NetworkAuthData
zypp::media::AuthData_Ptr AuthData_Ptr
zypp::media::CurlAuthData_Ptr NetworkAuthData_Ptr
zypp::repo::RepoException _error
Url::asString() view options.
connection _sigStartedConn
connection _sigFinishedConn
connection _sigProgressConn
#define ZYPP_IMPL_PRIVATE(Class)