Bug 166081

Summary: WebDAV PUT requests not issued (upload not working)
Product: [Unmaintained] kio Reporter: Tobias Schlitt <tobias>
Component: webdavAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ahartmetz, bugs, coder.tux, dpalacio, faure, maksim, martin.sandsmark, rgpublic, Stefan.Borggraefe, whyyousee
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch to fix the PUT issue in kioslave/http

Description Tobias Schlitt 2008-07-08 20:34:06 UTC
Version:           3.5.9 (using KDE 3.5.8)
Installed from:    Compiled From Sources
Compiler:          GCC i686-pc-linux-gnu-4.1.2 
OS:                Linux

When trying to upload a file to a WebDAV share with Konqueror, this does not have any effect and sometimes issues an error, that the WebDAV root does not exist.

This behavior results from a PROPFIND request that is issued before the actual PUT of the file, to check if the desired resource already exists on the server. The PROPFIND request returns status code 404, as expected, since the desired resource does not exist (yet). However, the 404 response seems to be caught in another place of the HTTP handling already, so that the desired PUT does not occur.

The following patch fixes the issue (thanks to <SadEagle> on #kde-devel@Freenode):

Index: http.cc
===================================================================
--- http.cc	(revision 829529)
+++ http.cc	(working copy)
@@ -4545,7 +4545,7 @@
                   << " bytes left! can't close cache entry!\n";
   }
 
-  if (sz <= 1)
+  if (sz <= 1  && m_request.method != DAV_PROPFIND)
   {
     /* kdDebug(7113) << "(" << m_pid << ") readBody: sz = " << KIO::number(sz)
                      << ", responseCode =" << m_responseCode << endl; */
Comment 1 Tobias Schlitt 2008-07-08 20:35:15 UTC
Created attachment 25951 [details]
Patch to fix the PUT issue in kioslave/http
Comment 2 David Faure 2009-03-16 13:40:33 UTC
Is this an issue in KDE-4.2 as well?
Comment 3 Matt C 2009-03-18 15:32:16 UTC
I can confirm this bug for 
Qt: 4.4.3
KDE: 4.2.00 (KDE 4.2.0)
Konqueror: 4.2.00 (KDE 4.2.0)
Comment 4 rgpublic 2009-09-01 19:34:07 UTC
I can confirm this bug for KDE 4.2.1. I'm trying out the PHP WebDAV server from PEAR and I have debugged the WebDAV server's source and the problem is definitely like the original poster said. After PROPFIND gets a 404 from the server the PUT is never issued. I get an error message (File not found) every time when trying to create new files. Editing existing files works however. I cannot confirm whether the patch works as I'm using KDE from precompiled packages.
Comment 5 Martin Sandsmark 2010-06-25 23:16:35 UTC
*** Bug 241360 has been marked as a duplicate of this bug. ***
Comment 6 David Palacio 2010-06-26 18:40:16 UTC
Using the same WevDav server the following KDE versions work:

4.3.5 Gentoo, 4.4.4 Gentoo.

192.168.1.101 192.168.1.2 - [26/Jun/2010:11:35:35 -0500] "PROPFIND /public/404.html HTTP/1.1" 404 345 "-" "Mozilla/5.0 (compatible; Konqueror/4.4; Linux) KHTML/4.4.4 (like Gecko)"
192.168.1.101 192.168.1.2 - [26/Jun/2010:11:35:35 -0500] "PUT /public/404.html HTTP/1.1" 201 0 "-" "Mozilla/5.0 (compatible; Konqueror/4.4; Linux) KHTML/4.4.4 (like Gecko)"


It does not work in a self compiled trunk KDE in Gentoo. It sends a PROPFIND but no PUT request to the server.

127.0.0.1 localhost - [26/Jun/2010:11:30:10 -0500] "PROPFIND /public/EV13p2.png HTTP/1.1" 404 345 "-" "Mozilla/5.0 (compatible; Konqueror/4.4) KHTML/4.4.90 (like Gecko)"
127.0.0.1 localhost - [26/Jun/2010:11:30:15 -0500] "PROPFIND /public/ HTTP/1.1" 207 910 "-" "Mozilla/5.0 (compatible; Konqueror/4.4) KHTML/4.4.90 (like Gecko)"
Comment 7 David Palacio 2010-06-26 18:54:22 UTC
If I replace the kdelibs/kioslave/http folder in trunk with the version from the 4.4 branch I can upload files to the webserver.
Comment 8 Martin Sandsmark 2010-07-10 22:38:22 UTC
SVN commit 1148486 by sandsmark:

Avoid setting an error if we're doing a DAV propfind, and the file doesn't exist.

CCBUG: 166081


 M  +3 -1      http.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1148486
Comment 9 Martin Sandsmark 2010-07-11 00:24:21 UTC
patch applied, seems to work, and backported to 4.5 branch.
Comment 10 Dawit Alemayehu 2011-07-10 07:22:47 UTC
*** Bug 156454 has been marked as a duplicate of this bug. ***