libzypp 17.35.9
|
The CurlMultiPartHandler class. More...
#include <zypp-curl/ng/network/curlmultiparthandler.h>
Classes | |
struct | Range |
Public Types | |
enum class | ProtocolMode { Basic , HTTP } |
enum | State { Pending , Running , Finished , Error } |
using | CheckSumBytes = UByteArray |
using | Code = NetworkRequestError::Type |
![]() | |
using | Ptr = std::shared_ptr<Base> |
using | WeakPtr = std::weak_ptr<Base> |
Public Member Functions | |
CurlMultiPartHandler (ProtocolMode mode, void *easyHandle, std::vector< Range > &ranges, CurlMultiPartDataReceiver &receiver) | |
~CurlMultiPartHandler () override | |
void * | easyHandle () const |
bool | canRecover () const |
bool | hasMoreWork () const |
bool | hasError () const |
Code | lastError () const |
const std::string & | lastErrorMessage () const |
bool | validateRange (Range &rng) |
bool | prepare () |
bool | prepareToContinue () |
void | finalize () |
bool | verifyData () |
std::optional< size_t > | reportedFileSize () const |
std::optional< off_t > | currentRange () const |
![]() | |
Base () | |
virtual | ~Base () |
WeakPtr | parent () const |
void | addChild (const Base::Ptr &child) |
void | removeChild (const Ptr &child) |
const std::unordered_set< Ptr > & | children () const |
std::thread::id | threadId () const |
template<typename T > | |
std::vector< std::weak_ptr< T > > | findChildren () const |
template<typename T > | |
std::shared_ptr< T > | shared_this () const |
template<typename T > | |
std::shared_ptr< T > | shared_this () |
template<typename T > | |
std::weak_ptr< T > | weak_this () const |
template<typename T > | |
std::weak_ptr< T > | weak_this () |
template<typename SenderFunc , typename ReceiverFunc > | |
auto | connect (SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> | |
std::enable_if_t< std::is_member_function_pointer_v< SenderFunc >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Static Public Attributes | |
static constexpr unsigned | _rangeAttempt [] |
static constexpr unsigned | _rangeAttemptSize = ( sizeof( _rangeAttempt ) / sizeof(unsigned) ) |
Private Member Functions | |
void | setCode (Code c, std::string msg, bool force=false) |
size_t | hdrcallback (char *ptr, size_t size, size_t nmemb) |
size_t | wrtcallback (char *ptr, size_t size, size_t nmemb) |
bool | parseContentRangeHeader (const std::string_view &line, size_t &start, size_t &len, size_t &fileLen) |
bool | parseContentTypeMultiRangeHeader (const std::string_view &line, std::string &boundary) |
bool | checkIfRangeChkSumIsValid (Range &rng) |
void | setRangeState (Range &rng, State state) |
Static Private Member Functions | |
static size_t | curl_hdrcallback (char *ptr, size_t size, size_t nmemb, void *userdata) |
static size_t | curl_wrtcallback (char *ptr, size_t size, size_t nmemb, void *userdata) |
Private Attributes | |
ProtocolMode | _protocolMode = ProtocolMode::HTTP |
void * | _easyHandle = nullptr |
CurlMultiPartDataReceiver & | _receiver |
Code | _lastCode = Code::NoError |
std::string | _lastErrorMsg |
bool | _allHeadersReceived = false |
bool | _gotContentRangeInfo = false |
bool | _isMuliPartResponse = false |
std::string | _seperatorString |
The seperator string for multipart responses as defined in RFC 7233 Section 4.1. | |
std::vector< char > | _rangePrefaceBuffer |
Here we buffer. | |
std::optional< off_t > | _currentRange |
std::optional< Range > | _currentSrvRange |
std::optional< size_t > | _reportedFileSize |
Filesize as reported by the content range or byte range headers. | |
unsigned | _rangeAttemptIdx = 0 |
std::vector< Range > & | _requestedRanges |
the requested ranges that need to be downloaded | |
Additional Inherited Members | |
![]() | |
template<typename Obj , typename Functor > | |
static decltype(auto) | make_base_slot (Obj *o, Functor &&f) |
template<typename SenderFunc , typename ReceiverFunc > | |
static auto | connect (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> | |
static auto | connectFunc (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
![]() | |
Base (BasePrivate &dd) | |
![]() | |
std::unique_ptr< BasePrivate > | d_ptr |
The CurlMultiPartHandler class.
multirange support for HTTP requests (https://tools.ietf.org/html/rfc7233), if not operating on a HTTP/HTTPS URL this will batch multirange requests one by one, so maybe don't use it there
Definition at line 68 of file curlmultiparthandler.h.
Definition at line 100 of file curlmultiparthandler.h.
Definition at line 101 of file curlmultiparthandler.h.
Enumerator | |
---|---|
Basic | |
HTTP |
Definition at line 72 of file curlmultiparthandler.h.
Enumerator | |
---|---|
Pending | |
Running | |
Finished | |
Error |
Definition at line 93 of file curlmultiparthandler.h.
zyppng::CurlMultiPartHandler::CurlMultiPartHandler | ( | ProtocolMode | mode, |
void * | easyHandle, | ||
std::vector< Range > & | ranges, | ||
CurlMultiPartDataReceiver & | receiver ) |
Definition at line 90 of file curlmultiparthandler.cc.
|
override |
Definition at line 103 of file curlmultiparthandler.cc.
void * zyppng::CurlMultiPartHandler::easyHandle | ( | ) | const |
Definition at line 423 of file curlmultiparthandler.cc.
bool zyppng::CurlMultiPartHandler::canRecover | ( | ) | const |
Definition at line 428 of file curlmultiparthandler.cc.
bool zyppng::CurlMultiPartHandler::hasMoreWork | ( | ) | const |
Definition at line 438 of file curlmultiparthandler.cc.
bool zyppng::CurlMultiPartHandler::hasError | ( | ) | const |
Definition at line 444 of file curlmultiparthandler.cc.
CurlMultiPartHandler::Code zyppng::CurlMultiPartHandler::lastError | ( | ) | const |
Definition at line 449 of file curlmultiparthandler.cc.
const std::string & zyppng::CurlMultiPartHandler::lastErrorMessage | ( | ) | const |
Definition at line 454 of file curlmultiparthandler.cc.
Definition at line 675 of file curlmultiparthandler.cc.
bool zyppng::CurlMultiPartHandler::prepare | ( | ) |
Definition at line 510 of file curlmultiparthandler.cc.
bool zyppng::CurlMultiPartHandler::prepareToContinue | ( | ) |
Definition at line 459 of file curlmultiparthandler.cc.
void zyppng::CurlMultiPartHandler::finalize | ( | ) |
Definition at line 478 of file curlmultiparthandler.cc.
bool zyppng::CurlMultiPartHandler::verifyData | ( | ) |
Definition at line 490 of file curlmultiparthandler.cc.
std::optional< size_t > zyppng::CurlMultiPartHandler::reportedFileSize | ( | ) | const |
Definition at line 723 of file curlmultiparthandler.cc.
std::optional< off_t > zyppng::CurlMultiPartHandler::currentRange | ( | ) | const |
Definition at line 718 of file curlmultiparthandler.cc.
Definition at line 631 of file curlmultiparthandler.cc.
|
staticprivate |
Definition at line 35 of file curlmultiparthandler.cc.
|
staticprivate |
Definition at line 44 of file curlmultiparthandler.cc.
|
private |
Definition at line 113 of file curlmultiparthandler.cc.
|
private |
Definition at line 192 of file curlmultiparthandler.cc.
|
private |
Definition at line 642 of file curlmultiparthandler.cc.
|
private |
Definition at line 661 of file curlmultiparthandler.cc.
Definition at line 691 of file curlmultiparthandler.cc.
Definition at line 711 of file curlmultiparthandler.cc.
|
staticconstexpr |
Definition at line 82 of file curlmultiparthandler.h.
|
staticconstexpr |
Definition at line 91 of file curlmultiparthandler.h.
|
private |
Definition at line 165 of file curlmultiparthandler.h.
Definition at line 166 of file curlmultiparthandler.h.
|
private |
Definition at line 167 of file curlmultiparthandler.h.
|
private |
Definition at line 169 of file curlmultiparthandler.h.
|
private |
Definition at line 170 of file curlmultiparthandler.h.
Definition at line 172 of file curlmultiparthandler.h.
Definition at line 173 of file curlmultiparthandler.h.
Definition at line 174 of file curlmultiparthandler.h.
|
private |
The seperator string for multipart responses as defined in RFC 7233 Section 4.1.
Definition at line 176 of file curlmultiparthandler.h.
|
private |
Here we buffer.
Definition at line 177 of file curlmultiparthandler.h.
|
private |
Definition at line 179 of file curlmultiparthandler.h.
|
private |
Definition at line 180 of file curlmultiparthandler.h.
|
private |
Filesize as reported by the content range or byte range headers.
Definition at line 181 of file curlmultiparthandler.h.
|
private |
Definition at line 183 of file curlmultiparthandler.h.
|
private |
the requested ranges that need to be downloaded
Definition at line 184 of file curlmultiparthandler.h.