XRootD
Loading...
Searching...
No Matches
XrdHttpTpcTPC.cc File Reference
#include "XrdHttp/XrdHttpExtHandler.hh"
#include "XrdNet/XrdNetAddr.hh"
#include "XrdNet/XrdNetUtils.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdSec/XrdSecEntity.hh"
#include "XrdSfs/XrdSfsInterface.hh"
#include "XrdSys/XrdSysAtomics.hh"
#include "XrdSys/XrdSysFD.hh"
#include "XrdVersion.hh"
#include "XrdXrootd/XrdXrootdTpcMon.hh"
#include "XrdOuc/XrdOucTUtils.hh"
#include "XrdHttpTpc/XrdHttpTpcUtils.hh"
#include "XrdHttp/XrdHttpUtils.hh"
#include <curl/curl.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <algorithm>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <thread>
#include "XrdHttpTpcState.hh"
#include "XrdHttpTpcStream.hh"
#include "XrdHttpTpcTPC.hh"
#include <fstream>
Include dependency graph for XrdHttpTpcTPC.cc:

Go to the source code of this file.

Functions

std::string encode_xrootd_opaque_to_uri (CURL *curl, const std::string &opaque)
static std::string PrepareURL (const std::string &input)
XrdHttpExtHandlerXrdHttpGetExtHandler (XrdSysError *log, const char *config, const char *, XrdOucEnv *myEnv)
 XrdVERSIONINFO (XrdHttpGetExtHandler, HttpTPC)

Function Documentation

◆ encode_xrootd_opaque_to_uri()

std::string encode_xrootd_opaque_to_uri ( CURL * curl,
const std::string & opaque )

Definition at line 231 of file XrdHttpTpcTPC.cc.

232{
233 std::stringstream parser(opaque);
234 std::string sequence;
235 std::stringstream output;
236 bool first = true;
237 while (getline(parser, sequence, '&')) {
238 if (sequence.empty()) {continue;}
239 size_t equal_pos = sequence.find('=');
240 char *val = NULL;
241 if (equal_pos != std::string::npos)
242 val = curl_easy_escape(curl, sequence.c_str() + equal_pos + 1, sequence.size() - equal_pos - 1);
243 // Do not emit parameter if value exists and escaping failed.
244 if (!val && equal_pos != std::string::npos) {continue;}
245
246 if (!first) output << "&";
247 first = false;
248 output << sequence.substr(0, equal_pos);
249 if (val) {
250 output << "=" << val;
251 curl_free(val);
252 }
253 }
254 return output.str();
255}
void getline(uchar *buff, int blen)

References getline().

Here is the call graph for this function:

◆ PrepareURL()

std::string PrepareURL ( const std::string & input)
static

Definition at line 301 of file XrdHttpTpcTPC.cc.

301 {
302 if (!strncmp(input.c_str(), "davs://", 7)) {
303 return "https://" + input.substr(7);
304 }
305 return input;
306}

Referenced by TPC::TPCHandler::ProcessReq().

Here is the caller graph for this function:

◆ XrdHttpGetExtHandler()

XrdHttpExtHandler * XrdHttpGetExtHandler ( XrdSysError * log,
const char * config,
const char * ,
XrdOucEnv * myEnv )

Definition at line 1126 of file XrdHttpTpcTPC.cc.

1126 {
1127 if (curl_global_init(CURL_GLOBAL_DEFAULT)) {
1128 log->Emsg("TPCInitialize", "libcurl failed to initialize");
1129 return NULL;
1130 }
1131
1132 TPCHandler *retval{NULL};
1133 if (!config) {
1134 log->Emsg("TPCInitialize", "TPC handler requires a config filename in order to load");
1135 return NULL;
1136 }
1137 try {
1138 log->Emsg("TPCInitialize", "Will load configuration for the TPC handler from", config);
1139 retval = new TPCHandler(log, config, myEnv);
1140 } catch (std::runtime_error &re) {
1141 log->Emsg("TPCInitialize", "Encountered a runtime failure when loading ", re.what());
1142 //printf("Provided env vars: %p, XrdInet*: %p\n", myEnv, myEnv->GetPtr("XrdInet*"));
1143 }
1144 return retval;
1145}
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)

References XrdSysError::Emsg().

Here is the call graph for this function:

◆ XrdVERSIONINFO()

XrdVERSIONINFO ( XrdHttpGetExtHandler ,
HttpTPC  )

References TPC::Pull, and XrdHttpGetExtHandler().

Here is the call graph for this function: