15 #include <curl/curl.h>
51 virtual bool MatchesPath(
const char *verb,
const char *path);
54 virtual int Init(
const char *cfgfile) {
return 0;}
58 static int sockopt_callback(
void * clientp, curl_socket_t curlfd, curlsocktype purpose);
59 static int opensocket_callback(
void *clientp,
61 struct curl_sockaddr *address);
63 static int closesocket_callback(
void *clientp, curl_socket_t fd);
67 TPCLogRecord(
XrdHttpExtReq & req,
const TpcType tpcType) : bytes_transferred( -1 ), status( -1 ),
68 tpc_status(-1), streams( 1 ), isIPv6(false), mReq(req), pmarkManager(mReq,tpcType), mTpcType(tpcType)
70 gettimeofday(&begT, 0);
74 std::string log_prefix;
81 off_t bytes_transferred;
98 void ConfigureCurlCA(
CURL *curl);
101 int RedirectTransfer(
CURL *curl,
const std::string &redirect_resource,
XrdHttpExtReq &req,
104 int OpenWaitStall(
XrdSfsFile &fh,
const std::string &resource,
int mode,
106 const std::string &authz);
109 bool &success, TPCLogRecord &,
bool shouldReturnErrorToClient =
true);
111 int GetContentLengthTPCPull(
CURL *curl,
XrdHttpExtReq &req, uint64_t & contentLength,
bool & success, TPCLogRecord &rec);
118 int SendPerfMarker(
XrdHttpExtReq &req, TPCLogRecord &rec, std::vector<State*> &state,
119 off_t bytes_transferred);
127 size_t streams, TPCLogRecord &rec);
129 size_t streams, std::vector<TPC::State*> &streams_handles,
130 std::vector<ManagedCurlHandle> &curl_handles,
133 int ProcessPushReq(
const std::string & resource,
XrdHttpExtReq &req);
134 int ProcessPullReq(
const std::string &resource,
XrdHttpExtReq &req);
137 std::string &path2,
bool &path2_alt);
138 bool Configure(
const char *configfn,
XrdOucEnv *myEnv);
142 void logTransferEvent(
LogMask lvl,
const TPCLogRecord &record,
143 const std::string &event,
const std::string &message=
"");
145 std::string generateClientErr(std::stringstream &err_ss,
const TPCLogRecord &rec, CURLcode cCode = CURLcode::CURLE_OK);
149 static int m_marker_period;
150 static size_t m_block_size;
151 static size_t m_small_block_size;
159 std::string m_cafile;
161 static uint64_t m_monid;
164 std::shared_ptr<XrdTlsTempCA> m_ca_file;
169 #ifdef USE_PIPELINING
170 static const int m_pipelining_multiplier = 16;
172 static const int m_pipelining_multiplier = 1;
179 static const long CONNECT_TIMEOUT = 60;
182 std::map<std::string,std::string> hdr2cgimap;
Utility functions for XrdHTTP.
TPCHandler(XrdSysError *log, const char *config, XrdOucEnv *myEnv)
virtual int ProcessReq(XrdHttpExtReq &req)
static constexpr std::string_view OSS_TASK_OPAQUE
virtual int Init(const char *cfgfile)
Initializes the external request handler.
virtual bool MatchesPath(const char *verb, const char *path)
Tells if the incoming path is recognized as one of the paths that have to be processed.
std::unique_ptr< CURL, CurlDeleter > ManagedCurlHandle
void operator()(CURL *curl)