Encapsulates a curl easy handle and provides an interface to send HTTP HEAD and (multi-)range queries.
Definition at line 43 of file RCurlConnection.hxx.
Classes | |
| struct | RStatus |
| Return value for both HEAD and GET requests. More... | |
| struct | RUserRange |
| Caller-provided byte-range of the remote resource together with a pointer to a buffer. More... | |
Public Member Functions | |
| RCurlConnection (const RCurlConnection &other)=delete | |
| RCurlConnection (const std::string &url) | |
| RCurlConnection (RCurlConnection &&other) | |
| ~RCurlConnection () | |
| void | ClearCredentials () |
| EHTTPCredentialsType | GetCredentialsType () const |
| const std::string & | GetEscapedUrl () const |
| std::size_t | GetMaxNRangesPerRequest () const |
| RCurlConnection & | operator= (const RCurlConnection &other)=delete |
| RCurlConnection & | operator= (RCurlConnection &&other) |
| 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. | |
| RStatus | SendRangesReq (std::size_t N, RUserRange *ranges) |
| Reads the given ranges from the remote resource. | |
| void | SetCredentials (const RS3Credentials &credentials) |
| void | SetCredentialsFromEnvironment () |
| Sets the credentials from process environment variables. | |
| void | SetMaxNRangesPerRequest (std::size_t val) |
Static Public Member Functions | |
| static int | GetCurlVersion () |
| Used for testing. | |
Static Public Attributes | |
| static constexpr std::uint64_t | kUnknownSize = static_cast<std::uint64_t>(-1) |
| Returned by SendHeadReq() if the HTTP response contains no content-length header. | |
Private Member Functions | |
| void | Perform (RStatus &status) |
| void | SetOptions () |
| void | SetupErrorBuffer () |
| RResult< void > | SetUrl (const std::string &url) |
Private Attributes | |
| std::unique_ptr< RHTTPCredentials > | fCredentials |
| std::unique_ptr< char[]> | fErrorBuffer |
| For use by libcurl. | |
| std::string | fEscapedUrl |
| The URL provided in the constructor escaped according to standard rules. | |
| void * | fHandle = nullptr |
| the CURL easy handle corresponding to this connection | |
| std::size_t | fMaxNRangesPerReqest = 0 |
| If set to zero, automatically adjust: try with all given ranges and as long as the number of ranges is too large, half it. | |
#include <ROOT/RCurlConnection.hxx>
|
explicit |
Definition at line 587 of file RCurlConnection.cxx.
| ROOT::Internal::RCurlConnection::~RCurlConnection | ( | ) |
Definition at line 606 of file RCurlConnection.cxx.
|
delete |
| ROOT::Internal::RCurlConnection::RCurlConnection | ( | RCurlConnection && | other | ) |
Definition at line 612 of file RCurlConnection.cxx.
| void ROOT::Internal::RCurlConnection::ClearCredentials | ( | ) |
Definition at line 874 of file RCurlConnection.cxx.
| ROOT::Internal::EHTTPCredentialsType ROOT::Internal::RCurlConnection::GetCredentialsType | ( | ) | const |
Definition at line 892 of file RCurlConnection.cxx.
|
static |
Used for testing.
Definition at line 582 of file RCurlConnection.cxx.
|
inline |
Definition at line 120 of file RCurlConnection.hxx.
|
inline |
Definition at line 123 of file RCurlConnection.hxx.
|
delete |
| RCurlConnection & ROOT::Internal::RCurlConnection::operator= | ( | RCurlConnection && | other | ) |
Definition at line 691 of file RCurlConnection.cxx.
| ROOT::Internal::RCurlConnection::RStatus ROOT::Internal::RCurlConnection::SendHeadReq | ( | std::uint64_t & | remoteSize | ) |
Checks if the resource exists and if it does, return the value of the content-length header as size.
Definition at line 730 of file RCurlConnection.cxx.
| ROOT::Internal::RCurlConnection::RStatus ROOT::Internal::RCurlConnection::SendRangesReq | ( | std::size_t | N, |
| RUserRange * | ranges ) |
Reads the given ranges from the remote resource.
The ranges can be in any order and also overlapping. They will be transformed in optimized HTTP ranges for a multi-range request. Ranges past the resource size are valid (but won't receive any data). No limit on the number of ranges; if fMaxNRangesPerReqest is zero, a valid batching of requests into multiple multi-range requests takes place automatically. The fNBytesRecv member of the ranges is only well-defined on success.
Definition at line 759 of file RCurlConnection.cxx.
| void ROOT::Internal::RCurlConnection::SetCredentials | ( | const RS3Credentials & | credentials | ) |
Definition at line 852 of file RCurlConnection.cxx.
| void ROOT::Internal::RCurlConnection::SetCredentialsFromEnvironment | ( | ) |
Sets the credentials from process environment variables.
Currently supported
Definition at line 900 of file RCurlConnection.cxx.
|
inline |
Definition at line 122 of file RCurlConnection.hxx.
|
private |
Definition at line 638 of file RCurlConnection.cxx.
|
private |
Definition at line 630 of file RCurlConnection.cxx.
|
private |
Definition at line 663 of file RCurlConnection.cxx.
|
private |
Definition at line 67 of file RCurlConnection.hxx.
|
private |
For use by libcurl.
Definition at line 74 of file RCurlConnection.hxx.
|
private |
The URL provided in the constructor escaped according to standard rules.
Definition at line 73 of file RCurlConnection.hxx.
|
private |
the CURL easy handle corresponding to this connection
Definition at line 68 of file RCurlConnection.hxx.
|
private |
If set to zero, automatically adjust: try with all given ranges and as long as the number of ranges is too large, half it.
If set to zero and automatic reduction of the number of requests is necessary, the number of requests that works will be saved for further requests with this object.
Definition at line 72 of file RCurlConnection.hxx.
|
staticconstexpr |
Returned by SendHeadReq() if the HTTP response contains no content-length header.
Definition at line 83 of file RCurlConnection.hxx.