1#ifndef ZYPP_NG_MEDIA_CURL_REQUEST_H_INCLUDED
2#define ZYPP_NG_MEDIA_CURL_REQUEST_H_INCLUDED
5#include <zypp-curl/ng/network/TransferSettings>
7#include <zypp-core/ng/base/Base>
8#include <zypp-core/ng/core/Url>
9#include <zypp-core/ng/core/ByteArray>
32 class NetworkRequestDispatcher;
46 using Ptr = std::shared_ptr<NetworkRequest>;
47 using WeakPtr = std::weak_ptr<NetworkRequest>;
83 std::chrono::microseconds
total;
132 void addRequestRange (
size_t start,
size_t len = 0, std::optional<zypp::Digest> &&digest = {},
CheckSumBytes expectedChkSum =
CheckSumBytes(), std::any userData = std::any(), std::optional<size_t> digestCompareLen = {}, std::optional<size_t> chksumpad = {} );
168 std::optional<Timings>
timings ()
const;
174 std::vector<char>
peekData ( off_t offset,
size_t count )
const;
242 NetworkRequestError
error ()
const;
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)
relates: Flags
Store and operate with byte count.
Compute Message Digests (MD5, SHA1 etc).
bool setExpectedFileChecksum(const zypp::CheckSum &expected)
zypp::ByteCount reportedByteCount() const
Returns the number of bytes that are reported from the backend as the full download size,...
const zypp::Pathname & targetFilePath() const
Returns the target filename path.
zypp::ByteCount downloadedByteCount() const
Returns the number of already downloaded bytes as reported by the backend.
void resetRequestRanges()
void setUrl(const Url &url)
This will change the URL of the request.
void setExpectedFileSize(zypp::ByteCount expectedFileSize)
void setPriority(Priority prio, bool triggerReschedule=true)
std::vector< char > peekData(off_t offset, size_t count) const
std::string contentType() const
Returns the content type as reported from the server.
void setFileOpenMode(FileMode mode)
Sets the file open mode to mode.
std::shared_ptr< zypp::Digest > DigestPtr
bool addRequestHeader(const std::string &header)
friend class NetworkRequestDispatcher
~NetworkRequest() override
std::shared_ptr< NetworkRequest > Ptr
void setOptions(Options opt)
FileMode fileOpenMode() const
Returns the currently configured file open mode.
zypp::ByteCount expectedFileSize() const
bool hasError() const
Checks if there was a error with the request.
State state() const
Returns the current state the HttpDownloadRequest is in.
friend class NetworkRequestDispatcherPrivate
SignalProxy< void(NetworkRequest &req, const NetworkRequestError &err)> sigFinished()
Signals that the download finished.
SignalProxy< void(NetworkRequest &req, zypp::ByteCount count)> sigBytesDownloaded()
Signals that new data has been downloaded, this is only the payload and does not include control data...
std::optional< Timings > timings() const
After the request is finished query the timings that were collected during download.
std::string extendedErrorString() const
In some cases, curl can provide extended error information collected at runtime.
NetworkRequest(Url url, zypp::Pathname targetFile, FileMode fMode=WriteExclusive)
Priority priority() const
NetworkRequestError error() const
Returns the last set Error.
void setTargetFilePath(const zypp::Pathname &path)
Changes the target file path of the download.
const zypp::Pathname & cookieFile() const
void * nativeHandle() const
void setCookieFile(zypp::Pathname cookieFile)
void addRequestRange(size_t start, size_t len=0, std::optional< zypp::Digest > &&digest={}, CheckSumBytes expectedChkSum=CheckSumBytes(), std::any userData=std::any(), std::optional< size_t > digestCompareLen={}, std::optional< size_t > chksumpad={})
std::vector< Range > failedRanges() const
const std::vector< Range > & requestedRanges() const
SignalProxy< void(NetworkRequest &req)> sigStarted()
Signals that the dispatcher dequeued the request and actually starts downloading data.
SignalProxy< void(NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow)> sigProgress()
Signals if there was data read from the download.
TransferSettings & transferSettings()
ZYPP_DECLARE_FLAGS(Options, OptionBits)
CurlMultiPartHandler::Range Range
std::weak_ptr< NetworkRequest > WeakPtr
const std::string & lastRedirectInfo() const
Easy-to use interface to the ZYPP dependency resolver.
zypp::media::AuthData AuthData
zypp::media::TransferSettings TransferSettings
std::chrono::microseconds appconnect
std::chrono::microseconds redirect
std::chrono::microseconds pretransfer
std::chrono::microseconds total
std::chrono::microseconds namelookup
std::chrono::microseconds connect
#define ZYPP_DECLARE_PRIVATE(Class)