26 int myPort,
XrdOss *theSS) {
54 Say.Emsg(
"RedirLocal",
"oss.localroot (replaced by xrdcmsredirlocal for localredirect) " \
55 "and xrdcmsredirlocal.localroot are undefined, define xrdcmsredirlocal.localroot");
60 Say.Emsg(
"RedirLocal",
"oss.localroot or xrdcmsredirlocal.localroot needs to be an absolute path");
73 if ((cfgFD =
open(filename, O_RDONLY, 0)) < 0) {
77 while ((word = Config.GetFirstWord(
true))) {
80 if (strcmp(word,
"xrdcmsredirlocal.readonlyredirect") == 0){
81 readOnlyredirect = std::string(Config.GetWord(
true)).find(
"true") != std::string::npos;
85 else if (strcmp(word,
"xrdcmsredirlocal.httpredirect") == 0){
86 httpRedirect = std::string(Config.GetWord(
true)).find(
"true") != std::string::npos;
90 else if (strcmp(word,
"xrdcmsredirlocal.localroot") == 0){
91 localroot = std::string(Config.GetWord(
false));
95 else if (strcmp(word,
"oss.localroot") == 0 &&
localroot.empty()){
96 localroot = std::string(Config.GetWord(
false));
136 if(strstr(EnvInfo->
Env(param),
"tried=localhost") !=
nullptr)
138 std::string newPath(path);
140 newPath =
"//" + newPath.substr(
localroot.size());
142 rcode =
nativeCmsFinder->Locate(Resp, newPath.c_str(), flags, EnvInfo);
144 const std::string errText { std::string(Resp.
getErrText()) +
':' + std::to_string(Resp.
getErrInfo()) + newPath};
155 if (strncmp(dialect.c_str(),
"http", 4) == 0 && !
httpRedirect)
169 if (strncmp(dialect.c_str(),
"http", 4) != 0)
172 int urlRedirSupport = Resp.
getUCap();
174 if (!urlRedirSupport)
178 int clientLRedirSupport = Resp.
getUCap();
180 if (!clientLRedirSupport)
186 if (!(strncmp(dialect.c_str(),
"http", 4) == 0 && flags == 0x20000000))
199 std::string ppath =
"file://" +
localroot + path;
200 if (strncmp(dialect.c_str(),
"http", 4) == 0)
204 Resp.
setErrInfo(-1, ppath.substr(0, ppath.find(path)).c_str());
XrdVERSIONINFO(XrdCmsGetClient, XrdCmsRedirLocal)
XrdCmsClient * XrdCmsGetClient(XrdSysLogger *Logger, int opMode, int myPort, XrdOss *theSS)
Necessary implementation for XRootD to get the Plug-in.
static XrdSysLogger Logger
XrdCmsClient(Persona acting)
@ amLocal
Not affiliated with a cluster.
int Configure(const char *cfn, char *Parms, XrdOucEnv *EnvInfo)
Configure the nativeCmsFinder.
~XrdCmsRedirLocal()
Destructor.
XrdCmsClient * nativeCmsFinder
used to forward requests to CmsFinder with regular implementation
void loadConfig(const char *filename)
int Locate(XrdOucErrInfo &Resp, const char *path, int flags, XrdOucEnv *EnvInfo)
XrdCmsRedirLocal(XrdSysLogger *Logger, int opMode, int myPort, XrdOss *theSS)
Constructor.
int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *EnvInfo)
const char * Set(const char *hSpec, int pNum=PortInSpec)
const XrdSecEntity * secEnv() const
const char * getErrText()
int setErrInfo(int code, const char *emsg)
XrdNetAddrInfo * addrInfo
Entity's connection details.
static const int uUrlOK
ucap: Supports async responses
static const int uLclF
ucap: Client is on a private net