XRootD
Loading...
Searching...
No Matches
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 176 of file XrdTpcTPC.cc.

177{
178 std::stringstream parser(opaque);
179 std::string sequence;
180 std::stringstream output;
181 bool first = true;
182 while (getline(parser, sequence, '&')) {
183 if (sequence.empty()) {continue;}
184 size_t equal_pos = sequence.find('=');
185 char *val = NULL;
186 if (equal_pos != std::string::npos)
187 val = curl_easy_escape(curl, sequence.c_str() + equal_pos + 1, sequence.size() - equal_pos - 1);
188 // Do not emit parameter if value exists and escaping failed.
189 if (!val && equal_pos != std::string::npos) {continue;}
190
191 if (!first) output << "&";
192 first = false;
193 output << sequence.substr(0, equal_pos);
194 if (val) {
195 output << "=" << val;
196 curl_free(val);
197 }
198 }
199 return output.str();
200}
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 242 of file XrdTpcTPC.cc.

242 {
243 if (!strncmp(input.c_str(), "davs://", 7)) {
244 return "https://" + input.substr(7);
245 }
246 return input;
247}

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

1064 {
1065 if (curl_global_init(CURL_GLOBAL_DEFAULT)) {
1066 log->Emsg("TPCInitialize", "libcurl failed to initialize");
1067 return NULL;
1068 }
1069
1070 TPCHandler *retval{NULL};
1071 if (!config) {
1072 log->Emsg("TPCInitialize", "TPC handler requires a config filename in order to load");
1073 return NULL;
1074 }
1075 try {
1076 log->Emsg("TPCInitialize", "Will load configuration for the TPC handler from", config);
1077 retval = new TPCHandler(log, config, myEnv);
1078 } catch (std::runtime_error &re) {
1079 log->Emsg("TPCInitialize", "Encountered a runtime failure when loading ", re.what());
1080 //printf("Provided env vars: %p, XrdInet*: %p\n", myEnv, myEnv->GetPtr("XrdInet*"));
1081 }
1082 return retval;
1083}
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: