No query attachments allowed for urls passed to kioslaves?

David Faure faure at kde.org
Tue Feb 10 12:17:33 GMT 2009


On Sunday 08 February 2009, Friedrich W. H. Kossebau wrote:
> Le dimanche, 8. février 2009, à 15:04, Friedrich W. H. Kossebau a écrit:
> > Le dimanche, 8. février 2009, à 11:35, Allan Sandfeld Jensen a écrit:
> > > > If yes,
> > > > is there a reason querys get stripped from urls before they get passed
> > > > to a kioslave?
> > >
> > > No, querys to not get stripped from urls, otherwise most PHP/ASP sites
> > > would not work at all. So you have probably encountered some special bug.

Let's not confuse HTTP get and listing with KDirModel :-)
I assume that your service kioslave shows directories and is therefore going via
KDirModel when being displayed in a dolphin view (in dolphin or konqueror).
In KDirModel there is code to strip out queries, the code says:

* For instance ksvn+http://url?rev=100 is the parent for ksvn+http://url/file?rev=100
* so we have to remove the query in both to be able to compare the URLs

but actually I'm not sure this is still needed now that there's a global hash of nodes,
and also the idea was not for such stripped urls to go back to kioslaves (although
maybe it happens when expanding nodes in a treeview). But I would need more
details and you changed your kioslave already, so I guess we should move on for now?

> > Meanwhile I encoded the service url in the path. The url
> > 	service://workstation/fantasy/gibt.es.auch.nicht/
> > works if I click on it, but if I enter it in the url bar and press enter,
> > the kioslave receives the url with the trailing "/" cut away
> > 	service://workstation/fantasy/gibt.es.auch.nicht

Well, that shouldn't matter, should it? if foo is a directory then foo and foo/ are about
the same thing, when listing them with kio (this is about listDir, right?)

> > Looking at the log (attached) I wonder:
> > How comes
> > 	KParts::BrowserRun::scanFile: MIME TYPE is "inode/directory"
> > when none of the slots in my kioslave are called to find this out?
> 
> Because currently it uses KMimeType::findByUrl( KRun::url() ) for all non-http 
> and queryless urls. And ends with guessing from the listing capability and 
> the trailing "/" it will be a directory. 
> 00375             if ( prot && prot->supportsListing() ) {
> 00376                 KMimeType::Ptr mime = mimeType( 
> QLatin1String("inode/directory") );

Right. Is this a problem? Why do you have a trailing "/" in the first place
if it's not a directory?
But you can disable this if you add defaultMimetype=application/octet-stream
to your .protocol file like kio_http does. It basically means: don't assume anything
from just looking at the URL.

> But why did I then reimplement the mimetype( KURL ) method of KIO::SlaveBase?

That's for the KIO::mimeType() job, which is asynchronous (and therefore not
used by fast KMimeType::findByUrl).

> Could there perhaps be a flag that there the protocol has lightweight mimetype 
> detection?

I think the above flag will do.

> This could also help with the rest of BrowserRun::scanFile(),

Yes, it will now call get(), from which you're supposed to emit the mimetype.
Well, for files! If this is supposed to be a directory (I'm confused about what
you want exactly) then the call to KIO::stat() happens first and can tell it's
a directory.

> where I wonder why not just HTTPProtocol::mimetype( KUrl ) is used?

Because this would involve two roundtrips to the HTTP server.
Let's assume HTTPProtocol::mimetype is involved with HTTP HEAD (but
that's so unreliable I'm not even sure that's still the case). If KRun
called it then you would get, for any url typed in konqueror, a
HTTP HEAD followed by a HTTP GET.
Instead, what happens currently is that KRun starts a HTTP GET,
which emits the mimetype before any data, KRun puts it on hold,
tells konq to load the part for mimetype xyz, which then does a KIO::get
which (via some magic in KIO scheduler) reuses the same kioslave
and resumes the same HTTP get download.

> > Still in the end it says
> > 	konqueror(23113) KonqView::openUrl: url=
> > KUrl("service://workstation/fantasy/gibt.es.auch.nicht/")
> > locationBarURL= "service://workstation/fantasy/gibt.es.auch.nicht/"
> > 	kio_slp(23115) ServicesSlave::listDir: url=
> > KUrl("service://workstation/fantasy/gibt.es.auch.nicht")
> > So who could munge away the trailing "/" between the two log enties (the
> > url stays unchanged in ServicesSlave::listDir(), so it should not be the
> > ioslave)

KDirLister simplifies urls by removing the trailing slash, to make it easier
to compare urls later on, but really, an ioslave isn't supposed to make
a difference based on a trailing slash being present or not....
Did you intend for those to be a different thing? That's very unlike
normal directories.... I suggest to find another solution... (/index.html? ;)

> > I played with different values for "URIMode" in the protocol file but that
> > had no effect

Can't see a relation.

-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kfm-devel mailing list