From 91ffcad4197a18888ac1f4998ccf0fc8dd026f0e Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Mon, 13 Apr 2015 09:14:10 +0200 Subject: [davfile] use PROPFIND for Stat() and Exists() --- xbmc/filesystem/DAVFile.cpp | 15 +++++++++++++++ xbmc/filesystem/DAVFile.h | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/xbmc/filesystem/DAVFile.cpp b/xbmc/filesystem/DAVFile.cpp index 9713c59e8e..d1964e79bf 100644 --- a/xbmc/filesystem/DAVFile.cpp +++ b/xbmc/filesystem/DAVFile.cpp @@ -130,6 +130,21 @@ bool CDAVFile::Delete(const CURL& url) return true; } +bool CDAVFile::Exists(const CURL& url) +{ + return Stat(url,NULL) == 0; +} + +int CDAVFile::Stat(const CURL& url, struct __stat64* buffer) +{ + CCurlFile dav; + std::string strRequest = "PROPFIND"; + dav.SetCustomRequest(strRequest); + dav.SetRequestHeader("depth", 0); + + return dav.Stat(url, buffer); +} + bool CDAVFile::Rename(const CURL& url, const CURL& urlnew) { if (m_opened) diff --git a/xbmc/filesystem/DAVFile.h b/xbmc/filesystem/DAVFile.h index 0190e8cdda..378ada8359 100644 --- a/xbmc/filesystem/DAVFile.h +++ b/xbmc/filesystem/DAVFile.h @@ -31,13 +31,15 @@ namespace XFILE virtual ~CDAVFile(void); virtual bool Execute(const CURL& url); - virtual bool Delete(const CURL& url); virtual bool Rename(const CURL& url, const CURL& urlnew); + virtual bool Exists(const CURL& url); + virtual int Stat(const CURL& url, struct __stat64* buffer); + virtual int GetLastResponseCode() { return lastResponseCode; } private: int lastResponseCode; }; -} \ No newline at end of file +} -- cgit v1.2.3