15 #include <curl/curl.h>
47 virtual bool MatchesPath(
const char *verb,
const char *path);
50 virtual int Init(
const char *cfgfile) {
return 0;}
54 static int sockopt_callback(
void * clientp, curl_socket_t curlfd, curlsocktype purpose);
55 static int opensocket_callback(
void *clientp,
57 struct curl_sockaddr *address);
59 static int closesocket_callback(
void *clientp, curl_socket_t fd);
63 TPCLogRecord(
XrdHttpExtReq & req) : bytes_transferred( -1 ), status( -1 ),
64 tpc_status(-1), streams( 1 ), isIPv6(false), mReq(req), pmarkManager(mReq)
66 gettimeofday(&begT, 0);
70 std::string log_prefix;
77 off_t bytes_transferred;
93 void ConfigureCurlCA(
CURL *curl);
96 int RedirectTransfer(
CURL *curl,
const std::string &redirect_resource,
XrdHttpExtReq &req,
99 int OpenWaitStall(
XrdSfsFile &fh,
const std::string &resource,
int mode,
101 const std::string &authz);
104 bool &success, TPCLogRecord &,
bool shouldReturnErrorToClient =
true);
106 int GetContentLengthTPCPull(
CURL *curl,
XrdHttpExtReq &req, uint64_t & contentLength,
bool & success, TPCLogRecord &rec);
113 int SendPerfMarker(
XrdHttpExtReq &req, TPCLogRecord &rec, std::vector<State*> &state,
114 off_t bytes_transferred);
122 size_t streams, TPCLogRecord &rec);
124 size_t streams, std::vector<TPC::State*> &streams_handles,
125 std::vector<ManagedCurlHandle> &curl_handles,
128 int ProcessPushReq(
const std::string & resource,
XrdHttpExtReq &req);
129 int ProcessPullReq(
const std::string &resource,
XrdHttpExtReq &req);
132 std::string &path2,
bool &path2_alt);
133 bool Configure(
const char *configfn,
XrdOucEnv *myEnv);
137 void logTransferEvent(
LogMask lvl,
const TPCLogRecord &record,
138 const std::string &event,
const std::string &message=
"");
140 std::string generateClientErr(std::stringstream &err_ss,
const TPCLogRecord &rec, CURLcode cCode = CURLcode::CURLE_OK);
142 std::string prepareURL(
XrdHttpExtReq &req,
bool & hasSetOpaque);
145 static int m_marker_period;
146 static size_t m_block_size;
147 static size_t m_small_block_size;
155 std::string m_cafile;
157 static uint64_t m_monid;
160 std::shared_ptr<XrdTlsTempCA> m_ca_file;
165 #ifdef USE_PIPELINING
166 static const int m_pipelining_multiplier = 16;
168 static const int m_pipelining_multiplier = 1;
175 static const long CONNECT_TIMEOUT = 60;
178 std::map<std::string,std::string> hdr2cgimap;
Utility functions for XrdHTTP.
TPCHandler(XrdSysError *log, const char *config, XrdOucEnv *myEnv)
virtual int ProcessReq(XrdHttpExtReq &req)
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)