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;
33 class NetworkRequestPrivate;
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;
275 SignalProxy<void ( NetworkRequest &req )>
sigStarted ();
280 SignalProxy<void ( NetworkRequest &req, zypp::ByteCount count )>
sigBytesDownloaded ();
287 SignalProxy<void ( NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow )>
sigProgress ();
295 SignalProxy<void ( NetworkRequest &req, const NetworkRequestError &err)>
sigFinished ( );
std::optional< Timings > timings() const
After the request is finished query the timings that were collected during download.
void * nativeHandle() const
zypp::ByteCount reportedByteCount() const
Returns the number of bytes that are reported from the backend as the full download size...
const std::vector< Range > & requestedRanges() const
std::chrono::microseconds connect
std::weak_ptr< Base > WeakPtr
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={})
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...
Store and operate with byte count.
const std::string & lastRedirectInfo() const
std::chrono::microseconds pretransfer
zypp::ByteCount downloadedByteCount() const
Returns the number of already downloaded bytes as reported by the backend.
friend class NetworkRequestDispatcher
NetworkRequest(Url url, zypp::Pathname targetFile, FileMode fMode=WriteExclusive)
std::chrono::microseconds appconnect
void setOptions(Options opt)
void resetRequestRanges()
TransferSettings & transferSettings()
void setExpectedFileSize(zypp::ByteCount expectedFileSize)
void setFileOpenMode(FileMode mode)
Sets the file open mode to mode.
bool hasError() const
Checks if there was a error with the request.
const zypp::Pathname & cookieFile() const
void setUrl(const Url &url)
This will change the URL of the request.
std::chrono::microseconds namelookup
bool addRequestHeader(const std::string &header)
zypp::media::AuthData AuthData
std::vector< char > peekData(off_t offset, size_t count) const
NetworkRequestError error() const
Returns the last set Error.
std::string extendedErrorString() const
In some cases, curl can provide extended error information collected at runtime.
zypp::media::TransferSettings TransferSettings
Priority priority() const
zypp::UByteArray UByteArray
const zypp::Pathname & targetFilePath() const
Returns the target filename path.
void setTargetFilePath(const zypp::Pathname &path)
Changes the target file path of the download.
CurlMultiPartHandler::Range Range
void setCookieFile(zypp::Pathname cookieFile)
std::string contentType() const
Returns the content type as reported from the server.
ZYPP_DECLARE_OPERATORS_FOR_FLAGS(zyppng::NetworkRequest::Options)
ZYPP_DECLARE_FLAGS(Options, OptionBits)
bool setExpectedFileChecksum(const zypp::CheckSum &expected)
#define ZYPP_DECLARE_PRIVATE(Class)
std::chrono::microseconds total
void setPriority(Priority prio, bool triggerReschedule=true)
State state() const
Returns the current state the HttpDownloadRequest is in.
std::chrono::microseconds redirect
std::shared_ptr< zypp::Digest > DigestPtr
SignalProxy< void(NetworkRequest &req, const NetworkRequestError &err)> sigFinished()
Signals that the download finished.
SignalProxy< void(NetworkRequest &req)> sigStarted()
Signals that the dispatcher dequeued the request and actually starts downloading data.
zypp::ByteCount expectedFileSize() const
FileMode fileOpenMode() const
Returns the currently configured file open mode.
std::vector< Range > failedRanges() const
Easy-to use interface to the ZYPP dependency resolver.
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.
~NetworkRequest() override
std::shared_ptr< Base > Ptr