Bug 60904 - HTTP KIO slave's stat always returns that a file exists
Summary: HTTP KIO slave's stat always returns that a file exists
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: http (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-08 06:54 UTC by Leif Huhn
Modified: 2003-07-08 11:47 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 Leif Huhn 2003-07-08 06:54:21 UTC
Version:            (using KDE KDE 3.1.2)

The http KIO slave doesn't even bother determining if a file exists in stat if not using webdav.

Ideally it should check.

If it doesn't check, then it should at least do the same thing the FTP KIO slave does when the server is braindamaged.  The FTP KIO slave does:

QString statSide = metaData(QString::fromLatin1("statSide"));
if ( statSide == "source" )
{
    kdDebug(7102) << "Not found, but assuming found, because some servers don't allow listing" << endl;
    // MS Server is incapable of handling "list <blah>" in a case insensitive way
    // But "retr <blah>" works. So lie in stat(), to get going...
    //
    // There's also the case of ftp://ftp2.3ddownloads.com/90380/linuxgames/loki/patches/ut/ut-patch-436.run
    // where listing permissions are denied, but downloading is still possible.
    shortStatAnswer( filename, false /*file, not dir*/ );
}
else
{
    error( ERR_DOES_NOT_EXIST, path );
}

For my application returning that a file *doesn't* exist is a more sensible default.
Comment 1 Waldo Bastian 2003-07-08 11:47:41 UTC
Subject: kdelibs/kioslave/http

CVS commit by waba: 

CCMAIL: 60904-done@bugs.kde.org
* Bounce referrer back to application
* Let stat() return what the application wants to hear. (BR60904)


  M +11 -0     http.cc   1.583


--- kdelibs/kioslave/http/http.cc  #1.582:1.583
@@ -322,4 +322,6 @@ void HTTPProtocol::resetSessionSettings(
   m_remoteRespTimeout = responseTimeout();
 
+  // Bounce back the actual referrer sent
+  setMetaData("referrer", m_request.referrer);
 
   // Set the SSL meta-data here...
@@ -523,4 +525,13 @@ void HTTPProtocol::stat(const KURL& url)
   if ( m_protocol != "webdav" && m_protocol != "webdavs" )
   {
+    QString statSide = metaData(QString::fromLatin1("statSide"));
+    if ( statSide != "source" )
+    {
+      // When uploading we assume the file doesn't exit
+      error( ERR_DOES_NOT_EXIST, url.prettyURL() );
+      return;
+    }
+
+    // When downloading we assume it exists
     UDSEntry entry;
     UDSAtom atom;