[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdelibs/kioslave/http
From: Hamish Rodda <rodda () kde ! org>
Date: 2005-12-28 8:40:10
Message-ID: 1135759210.833144.27686.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 491966 by rodda:
When uploading files to a webdav(s) URL, stat the file first to make
sure it doesn't already exist.
I would have expected this check to be within kio, but oh well, what's
an extra round trip anyway...
BUG:112132
M +37 -1 http.cc
M +12 -12 http.h
M +1 -0 webdav.protocol
M +1 -0 webdavs.protocol
--- branches/KDE/3.5/kdelibs/kioslave/http/http.cc #491965:491966
@@ -1245,7 +1245,7 @@
retrieveContent();
}
-void HTTPProtocol::put( const KURL &url, int, bool, bool)
+void HTTPProtocol::put( const KURL &url, int, bool overwrite, bool)
{
kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::put " << url.prettyURL()
<< endl;
@@ -1253,6 +1253,42 @@
if ( !checkRequestURL( url ) )
return;
+ // Webdav hosts are capable of observing overwrite == false
+ if (!overwrite && m_protocol.left(6) == "webdav") {
+ UDSEntry entry;
+ UDSAtom atom;
+
+ // check to make sure this host supports WebDAV
+ if ( !davHostOk() )
+ return;
+
+ QCString request;
+ request = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>"
+ "<D:propfind xmlns:D=\"DAV:\"><D:prop>"
+ "<D:creationdate/>"
+ "<D:getcontentlength/>"
+ "<D:displayname/>"
+ "<D:resourcetype/>"
+ "</D:prop></D:propfind>";
+
+ davSetRequest( request );
+
+ // WebDAV Stat or List...
+ m_request.method = DAV_PROPFIND;
+ m_request.query = QString::null;
+ m_request.cache = CC_Reload;
+ m_request.doProxy = m_bUseProxy;
+ m_request.davData.depth = 0;
+
+ if (!retrieveHeader(false))
+ return;
+
+ if (m_responseCode == 207) {
+ error(ERR_FILE_ALREADY_EXIST, QString::null);
+ return;
+ }
+ }
+
m_request.method = HTTP_PUT;
m_request.path = url.path();
m_request.query = QString::null;
--- branches/KDE/3.5/kdelibs/kioslave/http/http.h #491965:491966
@@ -74,7 +74,7 @@
port = 0;
doProxy = false;
}
-
+
QString hostname;
QString encoded_hostname;
short unsigned int port;
@@ -91,7 +91,7 @@
overwrite = false;
depth = 0;
}
-
+
QString desturl;
bool overwrite;
int depth;
@@ -100,7 +100,7 @@
/** The request for the current connection **/
struct HTTPRequest
{
- HTTPRequest ()
+ HTTPRequest ()
{
port = 0;
method = KIO::HTTP_UNKNOWN;
@@ -118,9 +118,9 @@
bErrorPage = false;
bUseCookiejar = false;
expireDate = 0;
- creationDate = 0;
+ creationDate = 0;
}
-
+
QString hostname;
QString encoded_hostname;
short unsigned int port;
@@ -143,8 +143,8 @@
QString id;
DAVRequest davData;
- bool bNoAuth; // Do not authenticate
-
+ bool bNoAuth; // Do not authenticate
+
// Cache related
QString cef; // Cache Entry File belonging to this URL.
bool bUseCache; // Whether the cache is active
@@ -190,7 +190,7 @@
virtual void slave_status();
virtual void get( const KURL& url );
- virtual void put( const KURL& url, int _mode, bool _overwrite,
+ virtual void put( const KURL& url, int _mode, bool overwrite,
bool _resume );
//----------------- Re-implemented methods for WebDAV -----------
@@ -293,7 +293,7 @@
void httpCheckConnection(); // Check whether to keep connection.
void forwardHttpResponseHeader();
-
+
bool readHeader();
bool sendBody();
@@ -400,7 +400,7 @@
* Resets settings related to parsing a response.
*/
void resetResponseSettings();
-
+
/**
* Resets any per connection settings. These are different from
* per-session settings in that they must be invalidates every time
@@ -503,8 +503,8 @@
QStringList m_qContentEncodings;
QString m_sContentMD5;
QString m_strMimeType;
-
+
//--- WebDAV
// Data structure to hold data which will be passed to an internal func.
QByteArray m_bufWebDavData;
@@ -529,7 +529,7 @@
//--- Proxy related members
bool m_bUseProxy;
bool m_bNeedTunnel; // Whether we need to make a SSL tunnel
- bool m_bIsTunneled; // Whether we have an active SSL tunnel
+ bool m_bIsTunneled; // Whether we have an active SSL tunnel
bool m_bProxyAuthValid;
int m_iProxyPort;
KURL m_proxyURL;
--- branches/KDE/3.5/kdelibs/kioslave/http/webdav.protocol #491965:491966
@@ -15,3 +15,4 @@
Icon=www
maxInstances=3
DocPath=kioslave/webdav.html
+Class=:internet
--- branches/KDE/3.5/kdelibs/kioslave/http/webdavs.protocol #491965:491966
@@ -15,3 +15,4 @@
Icon=www
config=webdav
DocPath=kioslave/webdavs.html
+Class=:internet
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic