Skip to content

Commit

Permalink
[XrdCl] TPC: use separate cgi element to mark user intension to deleg…
Browse files Browse the repository at this point in the history
…ate.

fixes #1118
  • Loading branch information
simonmichal committed Jan 22, 2020
1 parent 43eb599 commit f19b432
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/XrdCl/XrdClThirdPartyCopyJob.cc
Expand Up @@ -438,10 +438,7 @@ namespace XrdCl
//--------------------------------------------------------------------------
log->Debug( UtilityMsg, "Generating the destination TPC URL" );

if( delegate )
tpcKey = "delegate";
else
tpcKey = GenerateKey();
tpcKey = GenerateKey();

char *cgiBuff = new char[2048];
const char *cgiP = XrdOucTPC::cgiC2Dst( tpcKey.c_str(),
Expand All @@ -450,7 +447,8 @@ namespace XrdCl
0, cgiBuff, 2048, nbStrm,
GetSource().GetHostId().c_str(),
GetSource().GetProtocol().c_str(),
GetTarget().GetProtocol().c_str() );
GetTarget().GetProtocol().c_str(),
delegate );

if( *cgiP == '!' )
{
Expand Down
8 changes: 8 additions & 0 deletions src/XrdOuc/XrdOucTPC.cc
Expand Up @@ -53,6 +53,7 @@ const char *XrdOucTPC::tpcSpr = "tpc.spr";
const char *XrdOucTPC::tpcStr = "tpc.str";
const char *XrdOucTPC::tpcTpr = "tpc.tpr";
const char *XrdOucTPC::tpcTtl = "tpc.ttl";
const char *XrdOucTPC::tpcDlgOn = "tpc.dlgon";

/******************************************************************************/
/* c g i C 2 D s t */
Expand All @@ -63,6 +64,7 @@ const char *XrdOucTPC::cgiC2Dst(const char *cKey, const char *xSrc,
char *Buff, int Blen, int strms,
const char *iHst,
const char *sprt, const char *tprt,
bool dlgon,
bool push)
{
tpcInfo Info;
Expand Down Expand Up @@ -115,6 +117,12 @@ const char *XrdOucTPC::cgiC2Dst(const char *cKey, const char *xSrc,
if (Blen > 1) n = snprintf(bP, Blen, "&%s=1", tpcPsh);
}

// tpc.dlgon
{bP += n; Blen -= n;
const char* cgistr = dlgon ? "&%s=1" : "&%s=0";
if (Blen > 1) n = snprintf(bP, Blen, cgistr, tpcDlgOn);
}


// All done
//
Expand Down
3 changes: 2 additions & 1 deletion src/XrdOuc/XrdOucTPC.hh
Expand Up @@ -40,7 +40,7 @@ static
const char *cgiC2Dst(const char *cKey, const char *xSrc, const char *xLfn,
const char *xCks, char *Buff, int Blen, int strms=0,
const char *iHst=0, const char *sprt=0, const char *tprt=0,
bool push=false);
bool dlgon=false, bool push=false);

static
const char *cgiC2Src(const char *cKey, const char *xDst, int xTTL,
Expand All @@ -65,6 +65,7 @@ static const char *tpcSrc;
static const char *tpcStr;
static const char *tpcTpr;
static const char *tpcTtl;
static const char *tpcDlgOn;

XrdOucTPC() {}
~XrdOucTPC() {}
Expand Down

0 comments on commit f19b432

Please sign in to comment.