14 #ifndef ZYPP_NG_MEDIA_CURL_PRIVATE_REQUEST_P_H_INCLUDED 15 #define ZYPP_NG_MEDIA_CURL_PRIVATE_REQUEST_P_H_INCLUDED 17 #include <zypp-core/zyppng/base/private/base_p.h> 19 #include <zypp-media/MediaException> 20 #include <zypp-core/zyppng/base/Timer> 21 #include <zypp-core/base/Regex.h> 22 #include <curl/curl.h> 25 #include <zypp-core/Digest.h> 26 #include <zypp-core/AutoDispose.h> 28 #include <boost/optional.hpp> 109 auto ret = curl_easy_setopt(
_easyHandle, opt, data );
135 Signal< void ( NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow )>
_sigProgress;
136 Signal< void ( NetworkRequest &req, const NetworkRequestError &err )>
_sigFinished;
138 static int curlProgressCallback (
void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow );
140 size_t writeCallback (
char *ptr,
size_t size,
size_t nmemb );
142 std::unique_ptr< curl_slist, decltype (&curl_slist_free_all) >
_headers;
159 struct prepareNextRangeBatch_t;
215 std::vector<char>
peek_data_fd ( FILE *fd, off_t offset,
size_t count );
Signal< void(NetworkRequest &req)> _sigStarted
std::string errorMessage() const
NetworkRequest::Priority _priority
void setCurlOption(CURLoption opt, T data)
std::array< char, CURL_ERROR_SIZE+1 > _errorBuf
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
NetworkRequest::FileMode _fMode
bool checkIfRangeChkSumIsValid(const NetworkRequest::Range &rng)
Store and operate with byte count.
const std::string _currentCookieFile
NetworkRequest::Options _options
void resetActivityTimer()
zypp::ByteCount _contentLenght
bool prepareNextRangeBatch(std::string &errBuf)
running_t(pending_t &&prevState)
Signal< void(NetworkRequest &req, zypp::ByteCount count)> _sigBytesDownloaded
bool _requireStatusPartial
enum zyppng::NetworkRequestPrivate::ProtocolMode _protocolMode
void onActivityTimeout(Timer &)
zypp::Pathname _targetFile
virtual ~NetworkRequestPrivate()
size_t headerCallback(char *ptr, size_t size, size_t nmemb)
Signal< void(NetworkRequest &req, off_t dltotal, off_t dlnow, off_t ultotal, off_t ulnow)> _sigProgress
bool parseContentTypeMultiRangeHeader(const std::string_view &line, std::string &boundary)
bool initialize(std::string &errBuf)
The NetworkRequestError class Represents a error that occured in.
zypp::ByteCount _expectedFileSize
static constexpr int _rangeAttempt[]
bool _requireStatusPartial
bool setupHandle(std::string &errBuf)
std::string _seperatorString
The seperator string for multipart responses as defined in RFC 7233 Section 4.1.
bool _gotMultiRangeHeader
void validateRange(NetworkRequest::Range &rng)
std::unique_ptr< curl_slist, decltype(&curl_slist_free_all) > _headers
bool parseContentRangeHeader(const std::string_view &line, size_t &start, size_t &len)
std::vector< char > peek_data_fd(FILE *fd, off_t offset, size_t count)
Timer::Ptr _activityTimer
std::optional< NetworkRequest::Range > _currentSrvRange
static int curlProgressCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
std::string _lastRedirect
to log/report redirections
std::optional< NetworkRequestError > _cachedResult
TransferSettings _settings
NetworkRequestDispatcher * _dispatcher
std::vector< NetworkRequest::Range > _requestedRanges
the requested ranges that need to be downloaded
size_t writeCallback(char *ptr, size_t size, size_t nmemb)
AutoDispose<FILE*> calling ::fclose
Signal< void(NetworkRequest &req, const NetworkRequestError &err)> _sigFinished
zypp::ByteCount _contentLenght
std::vector< char > _rangePrefaceBuffer
Here we buffer.
NetworkRequestPrivate(Url &&url, zypp::Pathname &&targetFile, NetworkRequest::FileMode fMode, NetworkRequest &p)
void setResult(NetworkRequestError &&err)
bool prepareToContinue(std::string &errBuf)
bool _gotContentRangeHeader
NetworkRequestError _result
std::variant< pending_t, running_t, prepareNextRangeBatch_t, finished_t > _runningMode