libzypp 17.37.10

zyppng::CurlMultiPartHandler Class Reference

The CurlMultiPartHandler class. More...

`#include <zypp-curl/ng/network/curlmultiparthandler.h>`

Inheritance diagram for zyppng::CurlMultiPartHandler:

## Classes
struct | Range

## Public Types
enum class | ProtocolMode { Basic , HTTP }
enum | State { Pending , Running , Finished , Error }
using | CheckSumBytes = UByteArray
using | Code = NetworkRequestError::Type
Public Types inherited from zyppng::Base
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
Public Member Functions inherited from zyppng::Base
| 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
Static Public Member Functions inherited from zyppng::Base
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)
Protected Member Functions inherited from zyppng::Base
| Base (BasePrivate &dd)
Protected Attributes inherited from zyppng::Base
std::unique_ptr< BasePrivate > | d_ptr

## Detailed Description

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 69 of file curlmultiparthandler.h.

## Member Typedef Documentation

## ◆ CheckSumBytes

using zyppng::CurlMultiPartHandler::CheckSumBytes = UByteArray

Definition at line 101 of file curlmultiparthandler.h.

## ◆ Code

using zyppng::CurlMultiPartHandler::Code = NetworkRequestError::Type

Definition at line 102 of file curlmultiparthandler.h.

## Member Enumeration Documentation

## ◆ ProtocolMode

enum class zyppng::CurlMultiPartHandler::ProtocolMode
| strong

Enumerator
Basic |
HTTP |

Definition at line 73 of file curlmultiparthandler.h.

## ◆ State

enum zyppng::CurlMultiPartHandler::State

Enumerator
Pending |
Running |
Finished |
Error |

Definition at line 94 of file curlmultiparthandler.h.

## Constructor & Destructor Documentation

## ◆ CurlMultiPartHandler()

zyppng::CurlMultiPartHandler::CurlMultiPartHandler | ( | ProtocolMode | mode,
|  | void * | easyHandle,
|  | std::vector< Range > & | ranges,
|  | CurlMultiPartDataReceiver & | receiver )

Definition at line 102 of file curlmultiparthandler.cc.

## ◆ ~CurlMultiPartHandler()

zyppng::CurlMultiPartHandler::~CurlMultiPartHandler | ( |  | ) |
| override

Definition at line 115 of file curlmultiparthandler.cc.

## Member Function Documentation

## ◆ easyHandle()

void * zyppng::CurlMultiPartHandler::easyHandle | ( |  | ) | const

Definition at line 435 of file curlmultiparthandler.cc.

## ◆ canRecover()

bool zyppng::CurlMultiPartHandler::canRecover | ( |  | ) | const

Definition at line 440 of file curlmultiparthandler.cc.

## ◆ hasMoreWork()

bool zyppng::CurlMultiPartHandler::hasMoreWork | ( |  | ) | const

Definition at line 450 of file curlmultiparthandler.cc.

## ◆ hasError()

bool zyppng::CurlMultiPartHandler::hasError | ( |  | ) | const

Definition at line 456 of file curlmultiparthandler.cc.

## ◆ lastError()

CurlMultiPartHandler::Code zyppng::CurlMultiPartHandler::lastError | ( |  | ) | const

Definition at line 461 of file curlmultiparthandler.cc.

## ◆ lastErrorMessage()

const std::string & zyppng::CurlMultiPartHandler::lastErrorMessage | ( |  | ) | const

Definition at line 466 of file curlmultiparthandler.cc.

## ◆ validateRange()

bool zyppng::CurlMultiPartHandler::validateRange | ( | Range & | rng | ) |

Definition at line 687 of file curlmultiparthandler.cc.

## ◆ prepare()

bool zyppng::CurlMultiPartHandler::prepare | ( |  | ) |

Definition at line 522 of file curlmultiparthandler.cc.

## ◆ prepareToContinue()

bool zyppng::CurlMultiPartHandler::prepareToContinue | ( |  | ) |

Definition at line 471 of file curlmultiparthandler.cc.

## ◆ finalize()

void zyppng::CurlMultiPartHandler::finalize | ( |  | ) |

Definition at line 490 of file curlmultiparthandler.cc.

## ◆ verifyData()

bool zyppng::CurlMultiPartHandler::verifyData | ( |  | ) |

Definition at line 502 of file curlmultiparthandler.cc.

## ◆ reportedFileSize()

std::optional< size_t > zyppng::CurlMultiPartHandler::reportedFileSize | ( |  | ) | const

Definition at line 735 of file curlmultiparthandler.cc.

## ◆ currentRange()

std::optional< off_t > zyppng::CurlMultiPartHandler::currentRange | ( |  | ) | const

Definition at line 730 of file curlmultiparthandler.cc.

## ◆ setCode()

void zyppng::CurlMultiPartHandler::setCode | ( | Code | c,
|  | std::string | msg,
|  | bool | force = false )
| private

Definition at line 643 of file curlmultiparthandler.cc.

## ◆ curl_hdrcallback()

size_t zyppng::CurlMultiPartHandler::curl_hdrcallback | ( | char * | ptr,
|  | size_t | size,
|  | size_t | nmemb,
|  | void * | userdata )
| static private

Definition at line 35 of file curlmultiparthandler.cc.

## ◆ curl_wrtcallback()

size_t zyppng::CurlMultiPartHandler::curl_wrtcallback | ( | char * | ptr,
|  | size_t | size,
|  | size_t | nmemb,
|  | void * | userdata )
| static private

Definition at line 44 of file curlmultiparthandler.cc.

## ◆ hdrcallback()

size_t zyppng::CurlMultiPartHandler::hdrcallback | ( | char * | ptr,
|  | size_t | size,
|  | size_t | nmemb )
| private

Definition at line 125 of file curlmultiparthandler.cc.

## ◆ wrtcallback()

size_t zyppng::CurlMultiPartHandler::wrtcallback | ( | char * | ptr,
|  | size_t | size,
|  | size_t | nmemb )
| private

Definition at line 204 of file curlmultiparthandler.cc.

## ◆ parseContentRangeHeader()

bool zyppng::CurlMultiPartHandler::parseContentRangeHeader | ( | const std::string_view & | line,
|  | size_t & | start,
|  | size_t & | len,
|  | size_t & | fileLen )
| private

Definition at line 654 of file curlmultiparthandler.cc.

## ◆ parseContentTypeMultiRangeHeader()

bool zyppng::CurlMultiPartHandler::parseContentTypeMultiRangeHeader | ( | const std::string_view & | line,
|  | std::string & | boundary )
| private

Definition at line 673 of file curlmultiparthandler.cc.

## ◆ checkIfRangeChkSumIsValid()

bool zyppng::CurlMultiPartHandler::checkIfRangeChkSumIsValid | ( | Range & | rng | ) |
| private

Definition at line 703 of file curlmultiparthandler.cc.

## ◆ setRangeState()

void zyppng::CurlMultiPartHandler::setRangeState | ( | Range & | rng,
|  | State | state )
| private

Definition at line 723 of file curlmultiparthandler.cc.

## Member Data Documentation

## ◆ _rangeAttempt

unsigned zyppng::CurlMultiPartHandler::_rangeAttempt[]
| static constexpr

Initial value:
= {
255,
127,
63,
15,
5,
1
}

Definition at line 83 of file curlmultiparthandler.h.

## ◆ _rangeAttemptSize

unsigned zyppng::CurlMultiPartHandler::_rangeAttemptSize = ( sizeof( _rangeAttempt ) / sizeof(unsigned) )
| static constexpr

Definition at line 92 of file curlmultiparthandler.h.

## ◆ _protocolMode

ProtocolMode zyppng::CurlMultiPartHandler::_protocolMode = ProtocolMode::HTTP
| private

Definition at line 163 of file curlmultiparthandler.h.

## ◆ _easyHandle

void* zyppng::CurlMultiPartHandler::_easyHandle = nullptr
| private

Definition at line 164 of file curlmultiparthandler.h.

## ◆ _receiver

CurlMultiPartDataReceiver& zyppng::CurlMultiPartHandler::_receiver
| private

Definition at line 165 of file curlmultiparthandler.h.

## ◆ _lastCode

Code zyppng::CurlMultiPartHandler::_lastCode = Code::NoError
| private

Definition at line 167 of file curlmultiparthandler.h.

## ◆ _lastErrorMsg

std::string zyppng::CurlMultiPartHandler::_lastErrorMsg
| private

Definition at line 168 of file curlmultiparthandler.h.

## ◆ _allHeadersReceived

bool zyppng::CurlMultiPartHandler::_allHeadersReceived = false
| private

Definition at line 170 of file curlmultiparthandler.h.

## ◆ _gotContentRangeInfo

bool zyppng::CurlMultiPartHandler::_gotContentRangeInfo = false
| private

Definition at line 171 of file curlmultiparthandler.h.

## ◆ _isMuliPartResponse

bool zyppng::CurlMultiPartHandler::_isMuliPartResponse = false
| private

Definition at line 172 of file curlmultiparthandler.h.

## ◆ _seperatorString

std::string zyppng::CurlMultiPartHandler::_seperatorString
| private

The seperator string for multipart responses as defined in RFC 7233 Section 4.1.

Definition at line 174 of file curlmultiparthandler.h.

## ◆ _rangePrefaceBuffer

std::vector<char> zyppng::CurlMultiPartHandler::_rangePrefaceBuffer
| private

Here we buffer.

Definition at line 175 of file curlmultiparthandler.h.

## ◆ _currentRange

std::optional<off_t> zyppng::CurlMultiPartHandler::_currentRange
| private

Definition at line 177 of file curlmultiparthandler.h.

## ◆ _currentSrvRange

std::optional<Range> zyppng::CurlMultiPartHandler::_currentSrvRange
| private

Definition at line 178 of file curlmultiparthandler.h.

## ◆ _reportedFileSize

std::optional<size_t> zyppng::CurlMultiPartHandler::_reportedFileSize
| private

Filesize as reported by the content range or byte range headers.

Definition at line 179 of file curlmultiparthandler.h.

## ◆ _rangeAttemptIdx

unsigned zyppng::CurlMultiPartHandler::_rangeAttemptIdx = 0
| private

Definition at line 181 of file curlmultiparthandler.h.

## ◆ _requestedRanges

std::vector<Range>& zyppng::CurlMultiPartHandler::_requestedRanges
| private

the requested ranges that need to be downloaded

Definition at line 182 of file curlmultiparthandler.h.

The documentation for this class was generated from the following files:

- zypp-curl/ng/network/curlmultiparthandler.h
- zypp-curl/ng/network/curlmultiparthandler.cc