12#ifndef ROOT_RCurlConnection
13#define ROOT_RCurlConnection
39 std::variant<RS3Credentials>
fData;
83 static constexpr std::uint64_t
kUnknownSize =
static_cast<std::uint64_t
>(-1);
RCurlConnection(const RCurlConnection &other)=delete
void SetCredentials(const RS3Credentials &credentials)
void * fHandle
the CURL easy handle corresponding to this connection
void Perform(RStatus &status)
std::string fEscapedUrl
The URL provided in the constructor escaped according to standard rules.
RCurlConnection & operator=(const RCurlConnection &other)=delete
std::unique_ptr< char[]> fErrorBuffer
For use by libcurl.
RStatus SendRangesReq(std::size_t N, RUserRange *ranges)
Reads the given ranges from the remote resource.
const std::string & GetEscapedUrl() const
static constexpr std::uint64_t kUnknownSize
Returned by SendHeadReq() if the HTTP response contains no content-length header.
std::size_t fMaxNRangesPerReqest
If set to zero, automatically adjust: try with all given ranges and as long as the number of ranges i...
RCurlConnection(const std::string &url)
void SetMaxNRangesPerRequest(std::size_t val)
RStatus SendHeadReq(std::uint64_t &remoteSize)
Checks if the resource exists and if it does, return the value of the content-length header as size.
std::size_t GetMaxNRangesPerRequest() const
static int GetCurlVersion()
Used for testing.
void SetCredentialsFromEnvironment()
Sets the credentials from process environment variables.
RResult< void > SetUrl(const std::string &url)
RCurlConnection & operator=(RCurlConnection &&other)
std::unique_ptr< RHTTPCredentials > fCredentials
EHTTPCredentialsType GetCredentialsType() const
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
These are definitions of various free functions for the C-style compression routines in ROOT.
Small utility to parse cmdline options.
Return value for both HEAD and GET requests.
RStatus(EStatusCode code)
@ kTooManyRanges
should not get to the user; number of request ranges is automatically reduced as needed
Caller-provided byte-range of the remote resource together with a pointer to a buffer.
bool operator<(const RUserRange &other) const
std::size_t fNBytesRecv
Usually equal to fLength for a successful call unless range goes out of the size of the remote resour...
unsigned char * fDestination
EHTTPCredentialsType fType
std::variant< RS3Credentials > fData