XRootD
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 107 of file XrdHttpTpcTPC.cc.

108 {
109  std::stringstream parser(opaque);
110  std::string sequence;
111  std::stringstream output;
112  bool first = true;
113  while (getline(parser, sequence, '&')) {
114  if (sequence.empty()) {continue;}
115  size_t equal_pos = sequence.find('=');
116  char *val = NULL;
117  if (equal_pos != std::string::npos)
118  val = curl_easy_escape(curl, sequence.c_str() + equal_pos + 1, sequence.size() - equal_pos - 1);
119  // Do not emit parameter if value exists and escaping failed.
120  if (!val && equal_pos != std::string::npos) {continue;}
121 
122  if (!first) output << "&";
123  first = false;
124  output << sequence.substr(0, equal_pos);
125  if (val) {
126  output << "=" << val;
127  curl_free(val);
128  }
129  }
130  return output.str();
131 }
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 173 of file XrdHttpTpcTPC.cc.

173  {
174  if (!strncmp(input.c_str(), "davs://", 7)) {
175  return "https://" + input.substr(7);
176  }
177  return input;
178 }

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 891 of file XrdHttpTpcTPC.cc.

891  {
892  if (curl_global_init(CURL_GLOBAL_DEFAULT)) {
893  log->Emsg("TPCInitialize", "libcurl failed to initialize");
894  return NULL;
895  }
896 
897  TPCHandler *retval{NULL};
898  if (!config) {
899  log->Emsg("TPCInitialize", "TPC handler requires a config filename in order to load");
900  return NULL;
901  }
902  try {
903  log->Emsg("TPCInitialize", "Will load configuration for the TPC handler from", config);
904  retval = new TPCHandler(log, config, myEnv);
905  } catch (std::runtime_error &re) {
906  log->Emsg("TPCInitialize", "Encountered a runtime failure when loading ", re.what());
907  //printf("Provided env vars: %p, XrdInet*: %p\n", myEnv, myEnv->GetPtr("XrdInet*"));
908  }
909  return retval;
910 }
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   
)