Bug 119066 - error renaming webdavs folder
Summary: error renaming webdavs folder
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: webdav (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Hamish Rodda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-27 18:12 UTC by Maximilian Renkin
Modified: 2006-01-03 11:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maximilian Renkin 2005-12-27 18:12:34 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    SuSE RPMs
Compiler:          gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux) Compiler is standard suse 10.0 rpm, all Yast Online Updates done
OS:                Linux

in a webdavs folder, it is not possible to rename subfolders (at any level), but renaming  normal files is working. Tried with Konqueror as well as in Krusader. With WinXP the same folders can be renamed without problems, so it seems not to be a server side problem (apache 2). Error shown in Message box is (I only have it in german): "Bei Ausführung von Inhalt der angebenen Datei oder des angegebenen Ordners übernehmen ist der unerwartete Fehler 301 aufgetreten."
Tried in 2 PCs (Notebook and Desktop system, nearly identical config.
Comment 1 Thiago Macieira 2005-12-27 18:17:41 UTC
Confirmed on r487700.
Comment 2 Hamish Rodda 2005-12-28 05:47:19 UTC
This is a bug in apache.

Changing the User-Agent string in the MOVE header to "User-Agent: Microsoft Data Access Internet Publishing Provider DAV" makes the command succeed.  The request is properly formatted as per the RFC.

I have reported this to apache: http://issues.apache.org/bugzilla/show_bug.cgi?id=38059
Comment 3 Maximilian Renkin 2005-12-28 21:46:52 UTC
A comment in the reported Apache Bug (ID 38059, by Hamish Rodda) shows the solution:
In apache config there has to be a line, e.g. "BrowserMatch "Konqueror/3.5" redirect-carefully".
Similar lines are part of the default config, e.g. "BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully"). The comment above these explaines the reason.
Now renaming of directories is working in both konqueror and krusader.

There should be a hint in the Konqueror Documentation or - according to the apache config comment - a change regarding trailing slash in directory names should be considered
Comment 4 Thiago Macieira 2005-12-28 22:23:35 UTC
I'd rather not have to change my Apache config, unless I'm running a buggy version of Apache.

So, Hamish, who is right? kio_http or Apache? We cannot both be right.
Comment 5 Hamish Rodda 2005-12-29 03:13:32 UTC
Actually the spec says we SHOULD use trailing slashes on directories, so they are right (but they're being strict about it).

I'll look to see if we can pass the trailing slash.
Comment 6 Hamish Rodda 2006-01-03 11:56:47 UTC
SVN commit 493783 by rodda:

Work around Apache2 DAV module's insistence on trailing slashes at the
end of requests on directories.

BUG:119066


 M  +26 -0     http.cc  
 M  +1 -0      http.h  


--- branches/KDE/3.5/kdelibs/kioslave/http/http.cc #493782:493783
@@ -259,6 +259,7 @@
 void HTTPProtocol::resetResponseSettings()
 {
   m_bRedirect = false;
+  m_redirectLocation = KURL();
   m_bChunked = false;
   m_iSize = NO_SIZE;
 
@@ -1366,6 +1367,30 @@
 
   retrieveHeader( false );
 
+  if ( m_responseCode == 301 )
+  {
+    kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::re-rename " << m_redirectLocation.path() << endl;
+    // Work around strict Apache-2 WebDAV implementation which refuses to cooperate
+    // with webdav://host/directory, instead requiring webdav://host/directory/
+    if (m_redirectLocation.protocol() == "https")
+      m_redirectLocation.setProtocol("webdavs");
+    else
+      m_redirectLocation.setProtocol("webdav");
+
+    if ( !checkRequestURL( m_redirectLocation ) )
+      return;
+
+    m_request.method = DAV_MOVE;
+    m_request.path = m_redirectLocation.path();
+    m_request.davData.desturl = newDest.url();
+    m_request.davData.overwrite = overwrite;
+    m_request.query = QString::null;
+    m_request.cache = CC_Reload;
+    m_request.doProxy = m_bUseProxy;
+
+    retrieveHeader( false );
+  }
+
   if ( m_responseCode == 201 )
     davFinished();
   else
@@ -3561,6 +3586,7 @@
       return false;
     }
     m_bRedirect = true;
+    m_redirectLocation = u;
 
     if (!m_request.id.isEmpty())
     {
--- branches/KDE/3.5/kdelibs/kioslave/http/http.h #493782:493783
@@ -476,6 +476,7 @@
 
 //--- Settings related to a single response only
   QStringList m_responseHeader; // All headers
+  KURL m_redirectLocation;
   bool m_bRedirect; // Indicates current request is a redirection
 
   // Processing related