28 "HttpFileSystemPlugIn constructed with URL: %s.",
30 std::string origin = getenv(
"XRDXROOTD_PROXY")? getenv(
"XRDXROOTD_PROXY") :
"";
31 if ( origin.empty() || origin.find(
"=") == 0) {
32 ctx_ =
new Davix::Context();
33 davix_client_ =
new Davix::DavPosix(ctx_);
58 const std::string &dest,
63 const auto full_source_path = url_.
GetProtocol() +
"://"
65 + std::to_string(url_.
GetPort())
67 const auto full_dest_path = url_.
GetProtocol() +
"://"
69 + std::to_string(url_.
GetPort())
73 "HttpFileSystemPlugIn::Mv - src = %s, dest = %s, timeout = %d",
74 full_source_path.c_str(), full_dest_path.c_str(), timeout);
77 Posix::Rename(*davix_client_, full_source_path, full_dest_path, timeout);
79 if (status.IsError()) {
96 "HttpFileSystemPlugIn::Rm - path = %s, timeout = %d",
97 url.GetURL().c_str(), timeout);
99 auto status =
Posix::Unlink(*davix_client_, url.GetURL(), timeout);
101 if (status.IsError()) {
121 "HttpFileSystemPlugIn::MkDir - path = %s, flags = %d, timeout = %d",
122 url.GetURL().c_str(), flags, timeout);
124 auto status =
Posix::MkDir(*davix_client_, url.GetURL(), flags, mode, timeout);
125 if (status.IsError()) {
142 "HttpFileSystemPlugIn::RmDir - path = %s, timeout = %d",
143 url.GetURL().c_str(), timeout);
145 auto status =
Posix::RmDir(*davix_client_, url.GetURL(), timeout);
146 if (status.IsError()) {
161 const auto full_path = url.GetLocation();
165 "HttpFileSystemPlugIn::DirList - path = %s, flags = %d, timeout = %d",
166 full_path.c_str(), flags, timeout);
173 Posix::DirList(*davix_client_, full_path, details, recursive, timeout);
174 if (res.second.IsError()) {
176 full_path.c_str(), res.second.ToStr().c_str());
191 const auto full_path = url_.
GetProtocol() +
"://" +
193 std::to_string(url_.
GetPort()) +
"/" + path;
196 "HttpFileSystemPlugIn::Stat - path = %s, timeout = %d",
197 full_path.c_str(), timeout);
201 auto status =
Posix::Stat(*davix_client_, full_path, timeout, stat_info);
203 if (status.IsError()) {
217 const std::string &value) {
218 properties_[name] = value;
223 std::string &value)
const {
224 const auto p = properties_.find(name);
225 if (p == std::end(properties_)) {
virtual XRootDStatus Rm(const std::string &path, ResponseHandler *handler, uint16_t timeout) override
virtual bool GetProperty(const std::string &name, std::string &value) const override
virtual XRootDStatus DirList(const std::string &path, DirListFlags::Flags flags, ResponseHandler *handler, uint16_t timeout) override
virtual ~HttpFileSystemPlugIn() noexcept
virtual XRootDStatus Mv(const std::string &source, const std::string &dest, ResponseHandler *handler, uint16_t timeout) override
virtual XRootDStatus Stat(const std::string &path, ResponseHandler *handler, uint16_t timeout) override
virtual XRootDStatus RmDir(const std::string &path, ResponseHandler *handler, uint16_t timeout) override
virtual XRootDStatus MkDir(const std::string &path, MkDirFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, uint16_t timeout) override
HttpFileSystemPlugIn(const std::string &url)
virtual bool SetProperty(const std::string &name, const std::string &value) override
void Error(uint64_t topic, const char *format,...)
Report an error.
void Debug(uint64_t topic, const char *format,...)
Print a debug message.
Handle an async response.
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
std::string GetURL() const
Get the URL.
const std::string & GetHostName() const
Get the name of the target host.
void SetPath(const std::string &path)
Set the path.
const std::string & GetProtocol() const
Get the protocol.
int GetPort() const
Get the target port.
XRootDStatus Unlink(Davix::DavPosix &davix_client, const std::string &url, uint16_t timeout)
XRootDStatus Rename(Davix::DavPosix &davix_client, const std::string &source, const std::string &dest, uint16_t timeout)
StatImpl< false > Stat(Ctx< File > file, Arg< bool > force, uint16_t timeout=0)
Davix::Context * root_ctx_
Davix::DavPosix * root_davix_client_
void SetUpLogging(Log *logger)
static const uint64_t kLogXrdClHttp
DirListImpl< false > DirList
@ Recursive
Do a recursive listing.