XRootD
Loading...
Searching...
No Matches
TPC::TPCHandler Class Reference

#include <XrdHttpTpcTPC.hh>

Inheritance diagram for TPC::TPCHandler:
Collaboration diagram for TPC::TPCHandler:

Public Member Functions

 TPCHandler (XrdSysError *log, const char *config, XrdOucEnv *myEnv)
virtual ~TPCHandler ()
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.
virtual int ProcessReq (XrdHttpExtReq &req)
Public Member Functions inherited from XrdHttpExtHandler
 XrdHttpExtHandler ()
 Constructor.
virtual ~XrdHttpExtHandler ()
 Destructor.

Static Public Attributes

static constexpr std::string_view OSS_TASK_OPAQUE = "oss.task=httptpc"

Detailed Description

Definition at line 46 of file XrdHttpTpcTPC.hh.

Constructor & Destructor Documentation

◆ TPCHandler()

TPCHandler::TPCHandler ( XrdSysError * log,
const char * config,
XrdOucEnv * myEnv )

Definition at line 288 of file XrdHttpTpcTPC.cc.

288 :
289 m_desthttps(false),
290 m_fixed_route(false),
291 m_timeout(60),
292 m_first_timeout(120),
293 m_log(log->logger(), "TPC_"),
294 m_sfs(NULL)
295{
296 if (!Configure(config, myEnv)) {
297 throw std::runtime_error("Failed to configure the HTTP third-party-copy handler.");
298 }
299
300// Extract out the TPC monitoring object (we share it with xrootd).
301//
302 XrdXrootdGStream *gs = (XrdXrootdGStream*)myEnv->GetPtr("Tpc.gStream*");
303 if (gs)
304 TPCLogRecord::tpcMonitor = new XrdXrootdTpcMon("http",log->logger(),*gs);
305}
void * GetPtr(const char *varname)
Definition XrdOucEnv.cc:263
XrdSysLogger * logger(XrdSysLogger *lp=0)

References XrdOucEnv::GetPtr(), if(), and XrdSysError::logger().

Here is the call graph for this function:

◆ ~TPCHandler()

TPCHandler::~TPCHandler ( )
virtual

Definition at line 280 of file XrdHttpTpcTPC.cc.

280 {
281 m_sfs = NULL;
282}

Member Function Documentation

◆ Init()

virtual int TPC::TPCHandler::Init ( const char * cfgfile)
inlinevirtual

Initializes the external request handler.

Implements XrdHttpExtHandler.

Definition at line 54 of file XrdHttpTpcTPC.hh.

54{return 0;}

◆ MatchesPath()

bool TPCHandler::MatchesPath ( const char * verb,
const char * path )
virtual

Tells if the incoming path is recognized as one of the paths that have to be processed.

Implements XrdHttpExtHandler.

Definition at line 233 of file XrdHttpTpcTPC.cc.

233 {
234 return !strcmp(verb, "COPY") || !strcmp(verb, "OPTIONS");
235}

◆ ProcessReq()

int TPCHandler::ProcessReq ( XrdHttpExtReq & )
virtual

Process an HTTP request and send the response using the calling XrdHttpProtocol instance directly Returns 0 if ok, non0 if errors

Implements XrdHttpExtHandler.

Definition at line 252 of file XrdHttpTpcTPC.cc.

252 {
253 if (req.verb == "OPTIONS") {
254 return ProcessOptionsReq(req);
255 }
256 auto header = XrdOucTUtils::caseInsensitiveFind(req.headers,"credential");
257 if (header != req.headers.end()) {
258 if (header->second != "none") {
259 m_log.Emsg("ProcessReq", "COPY requested an unsupported credential type: ", header->second.c_str());
260 return req.SendSimpleResp(400, NULL, NULL, "COPY requestd an unsupported Credential type", 0);
261 }
262 }
263 header = XrdOucTUtils::caseInsensitiveFind(req.headers,"source");
264 if (header != req.headers.end()) {
265 std::string src = PrepareURL(header->second);
266 return ProcessPullReq(src, req);
267 }
268 header = XrdOucTUtils::caseInsensitiveFind(req.headers,"destination");
269 if (header != req.headers.end()) {
270 return ProcessPushReq(header->second, req);
271 }
272 m_log.Emsg("ProcessReq", "COPY verb requested but no source or destination specified.");
273 return req.SendSimpleResp(400, NULL, NULL, "No Source or Destination specified", 0);
274}
static std::string PrepareURL(const std::string &input)
static std::map< std::string, T >::const_iterator caseInsensitiveFind(const std::map< std::string, T > &m, const std::string &lowerCaseSearchKey)

References XrdOucTUtils::caseInsensitiveFind(), XrdHttpExtReq::headers, PrepareURL(), XrdHttpExtReq::SendSimpleResp(), and XrdHttpExtReq::verb.

Here is the call graph for this function:

Member Data Documentation

◆ OSS_TASK_OPAQUE

std::string_view TPC::TPCHandler::OSS_TASK_OPAQUE = "oss.task=httptpc"
staticconstexpr

Definition at line 55 of file XrdHttpTpcTPC.hh.

Referenced by XrdHttpTpcUtils::prepareOpenURL().


The documentation for this class was generated from the following files: