71 st = sidMgr->AllocateSID( req->
streamid );
100 msgHandler =
new XRootDMsgHandler( msg, handler, &url, sidMgr, lFileHandler );
121 list->push_back( url );
127 st = postMaster->
Send( url, msg, msgHandler, sendParams.
stateful,
140 sidMgr->ReleaseSID( req->
streamid );
182 msgHandler =
new XRootDMsgHandler( msg, handler, &url, std::shared_ptr<SIDManager>(), lFileHandler );
197 list->push_back( info );
203 st = postMaster->
Redirect( url, msg, msgHandler );
229 env->
GetInt(
"RequestTimeout", requestTimeout );
230 sendParams.
timeout = requestTimeout;
242 env->
GetInt(
"RedirectLimit", redirectLimit );
253 const std::string &newPath )
274 for(
int i = 0; i < req->
header.
dlen; ++i, ++path, --length )
284 char *pathWithNull =
new char[length+1];
285 memcpy( pathWithNull, path, length );
286 pathWithNull[length] = 0;
287 std::ostringstream o;
288 o <<
"fake://fake:111/" << pathWithNull;
289 delete [] pathWithNull;
291 URL currentPath( o.str() );
293 MergeCGI( currentCgi, newCgi, replace );
295 if( !newPath.empty() )
296 currentPath.
SetPath( newPath );
302 uint32_t newDlen = req->
header.
dlen - length + newPathWitParams.size();
308 for(
int i = 0; i < req->
header.
dlen; ++i, ++path )
313 memcpy( path, newPathWitParams.c_str(), newPathWitParams.size() );
321 env->
GetInt(
"PreserveLocateTried", preserveLocateTried );
323 if( !preserveLocateTried )
break;
329 URL::ParamsMap::const_iterator itr = newCgi.find(
"triedrc" );
330 if( itr != newCgi.end() )
331 triedCgi[itr->first] = itr->second;
332 itr = newCgi.find(
"tried" );
333 if( itr != newCgi.end() )
334 triedCgi[itr->first] = itr->second;
339 if( triedCgi.empty() )
break;
350 std::string strpath( path, length );
351 std::ostringstream o;
352 o <<
"fake://fake:111/" << strpath;
354 URL currentPath( o.str() );
356 MergeCGI( currentCgi, triedCgi, replace );
363 uint32_t newDlen = pathWitParams.size();
367 memcpy( path, pathWitParams.c_str(), pathWitParams.size() );
382 URL::ParamsMap::const_iterator it;
383 for( it = cgi2.begin(); it != cgi2.end(); ++it )
385 if( replace || cgi1.find( it->first ) == cgi1.end() )
386 cgi1[it->first] = it->second;
389 std::string &v = cgi1[it->first];
405 std::vector<char> &avec )
418 static const int name_overhead = 3;
420 static const int value_overhead = 4;
422 size_t nlen = 0, vlen = 0;
423 for(
auto itr = attrs.begin(); itr != attrs.end(); ++itr )
425 nlen += std::get<xattr_name>( *itr ).size() + name_overhead;
426 vlen += std::get<xattr_value>( *itr ).size() + value_overhead;
438 avec.resize( nlen + vlen, 0 );
439 char *nvec = avec.data(), *vvec = avec.data() + nlen;
441 for(
auto itr = attrs.begin(); itr != attrs.end(); ++itr )
443 const std::string &name = std::get<xattr_name>( *itr );
445 const std::string &value = std::get<xattr_value>( *itr );
456 std::vector<char> &nvec )
469 static const int name_overhead = 3;
472 for(
auto itr = attrs.begin(); itr != attrs.end(); ++itr )
473 nlen += itr->size() + name_overhead;
481 nvec.resize( nlen, 0 );
482 char *nptr = nvec.data();
484 for(
auto itr = attrs.begin(); itr != attrs.end(); ++itr )
static const int kXR_ckpXeq
struct ClientRequestHdr header
struct ClientChkPointRequest chkpoint
const char * GetBuffer(uint32_t offset=0) const
Get the message buffer.
void ReAllocate(uint32_t size)
Reallocate the buffer to a new location of a given size.
static Log * GetLog()
Get default log.
static PostMaster * GetPostMaster()
Get default post master.
static Env * GetEnv()
Get default client environment.
bool GetInt(const std::string &key, int &value)
void Error(uint64_t topic, const char *format,...)
Report an error.
void Dump(uint64_t topic, const char *format,...)
Print a dump message.
static void MergeCGI(URL::ParamsMap &cgi1, const URL::ParamsMap &cgi2, bool replace)
Merge cgi2 into cgi1.
static Status CreateXAttrVec(const std::vector< xattr_t > &attrs, std::vector< char > &avec)
Create xattr vector.
static void ProcessSendParams(MessageSendParams &sendParams)
Process sending params.
static void RewriteCGIAndPath(Message *msg, const URL::ParamsMap &newCgi, bool replace, const std::string &newPath)
Append cgi to the one already present in the message.
static Status RedirectMessage(const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams, LocalFileHandler *lFileHandler)
Redirect message.
static XRootDStatus SendMessage(const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams, LocalFileHandler *lFileHandler)
Send message.
The message representation used throughout the system.
const std::string & GetObfuscatedDescription() const
Get the description of the message with authz parameter obfuscated.
A hub for dispatching and receiving messages.
XRootDStatus Send(const URL &url, Message *msg, MsgHandler *handler, bool stateful, time_t expires)
Status Redirect(const URL &url, Message *msg, MsgHandler *handler)
Singleton access to URL to virtual redirector mapping.
static RedirectorRegistry & Instance()
Returns reference to the single instance.
XRootDStatus Register(const URL &url)
Creates a new virtual redirector and registers it (async).
Handle an async response.
static SIDMgrPool & Instance()
std::string GetHostId() const
Get the host part of the URL (user:password@host:port)
std::map< std::string, std::string > ParamsMap
void SetParams(const std::string ¶ms)
Set params.
std::string GetPathWithFilteredParams() const
Get the path with params, filteres out 'xrdcl.'.
void SetPath(const std::string &path)
Set the path.
const ParamsMap & GetParams() const
Get the URL params.
bool IsValid() const
Is the url valid.
Handle/Process/Forward XRootD messages.
void SetRedirectCounter(uint16_t redirectCounter)
Set the redirect counter.
void SetFollowMetalink(bool followMetalink)
void SetChunkList(ChunkList *chunkList)
Set the chunk list.
void SetHostList(HostList *hostList)
Set host list.
void SetCrc32cDigests(std::vector< uint32_t > &&crc32cDigests)
void SetLoadBalancer(const HostInfo &loadBalancer)
Set the load balancer.
void SetStateful(bool stateful)
void SetOksofarAsAnswer(bool oksofarAsAnswer)
void SetKernelBuffer(XrdSys::KernelBuffer *kbuff)
Set the kernel buffer.
void SetExpiration(time_t expiration)
Set a timestamp after which we give up.
void SetRedirectAsAnswer(bool redirectAsAnswer)
static void SetDescription(Message *msg)
Get the description of a message.
static XRootDStatus UnMarshallRequest(Message *msg)
static XRootDStatus MarshallRequest(Message *msg)
Marshal the outgoing message.
const int DefaultPreserveLocateTried
const int DefaultRedirectLimit
const uint16_t errUninitialized
const uint16_t stError
An error occurred that could potentially be retried.
std::vector< HostInfo > HostList
const uint16_t errInvalidArgs
const int DefaultRequestTimeout
static char * VVecInsert(const char *value, char *buffer)
static char * NVecInsert(const char *name, char *buffer)
std::vector< uint32_t > crc32cDigests
XrdSys::KernelBuffer * kbuff
Procedure execution status.
bool IsOK() const
We're fine.
std::string ToString() const
Create a string representation.