XRootD
XrdTpcTPC.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 "XrdTpc/XrdTpcUtils.hh"
#include <curl/curl.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <algorithm>
#include <memory>
#include <sstream>
#include <stdexcept>
#include <thread>
#include <iostream>
#include "XrdTpcState.hh"
#include "XrdTpcStream.hh"
#include "XrdTpcTPC.hh"
#include "XrdTpcCurlMulti.hh"
#include <fstream>
+ Include dependency graph for XrdTpcTPC.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 191 of file XrdTpcTPC.cc.

192 {
193  std::stringstream parser(opaque);
194  std::string sequence;
195  std::stringstream output;
196  bool first = true;
197  while (getline(parser, sequence, '&')) {
198  if (sequence.empty()) {continue;}
199  size_t equal_pos = sequence.find('=');
200  char *val = NULL;
201  if (equal_pos != std::string::npos)
202  val = curl_easy_escape(curl, sequence.c_str() + equal_pos + 1, sequence.size() - equal_pos - 1);
203  // Do not emit parameter if value exists and escaping failed.
204  if (!val && equal_pos != std::string::npos) {continue;}
205 
206  if (!first) output << "&";
207  first = false;
208  output << sequence.substr(0, equal_pos);
209  if (val) {
210  output << "=" << val;
211  curl_free(val);
212  }
213  }
214  return output.str();
215 }
void getline(uchar *buff, int blen)

References getline().

+ Here is the call graph for this function:

◆ PrepareURL()

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

Definition at line 257 of file XrdTpcTPC.cc.

257  {
258  if (!strncmp(input.c_str(), "davs://", 7)) {
259  return "https://" + input.substr(7);
260  }
261  return input;
262 }

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 1081 of file XrdTpcTPC.cc.

1081  {
1082  if (curl_global_init(CURL_GLOBAL_DEFAULT)) {
1083  log->Emsg("TPCInitialize", "libcurl failed to initialize");
1084  return NULL;
1085  }
1086 
1087  TPCHandler *retval{NULL};
1088  if (!config) {
1089  log->Emsg("TPCInitialize", "TPC handler requires a config filename in order to load");
1090  return NULL;
1091  }
1092  try {
1093  log->Emsg("TPCInitialize", "Will load configuration for the TPC handler from", config);
1094  retval = new TPCHandler(log, config, myEnv);
1095  } catch (std::runtime_error &re) {
1096  log->Emsg("TPCInitialize", "Encountered a runtime failure when loading ", re.what());
1097  //printf("Provided env vars: %p, XrdInet*: %p\n", myEnv, myEnv->GetPtr("XrdInet*"));
1098  }
1099  return retval;
1100 }
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95

References XrdSysError::Emsg().

+ Here is the call graph for this function:

◆ XrdVERSIONINFO()

XrdVERSIONINFO ( XrdHttpGetExtHandler  ,
HttpTPC   
)