KRun and Redirection
Dawit A.
adawit at kde.org
Sun Apr 18 20:54:37 BST 2004
On Sunday 18 April 2004 14:36, David Faure wrote:
> On Wednesday 14 April 2004 20:56, Dawit A. wrote:
>
> Hmm, but you're talking about ::stat, not about ::mimetype... Why should
> redirections in ::stat() matter? There again, if KRun finds out "it's a
> directory" it will open it (and get redirected again)
It does matter because what you originally stat'ed and what you eventually end
up opening might be different, no ? Or in the least you end up performing the
same another unnecessary stat in the ioslave. For the sake of simplicity let
me go through the kio_sftp problem I mentioned in sequence:
1.) User types "sftp://somehost" (note no path).
2.) Konqueror says I need to find out mime type and call KonqRun.
3.) KonqRun calls all its parents which eventually ends up in KRun::init.
4.) KonqRun::init does a KIO::stat.
5.) kio_sftp gets the stat call and says ahhh no path, let me ask the remote
server for the default path and does exactly that.
6.) Remote ssh server sends back the default path based on the logged in user.
7.) kio_sftp says thanks and sends a redirect request to the new path and
returns.
8.) This redirect is intercepted by KIO::StatJob which automatically asks the
slave to redo the stat call on the redirected URL. It also emits the
redirection signal to update the app.
The problem happens at this point. Since KRun::init completely ignores this
redirection signal instead of reemitting it so that the actual app can act
upon it, the app assumes everything is okay and continues to use the old URL.
This means any ioslave that does anything like what sftp does here must add
code in all the base io-slave function to catch such scenarios. Moreover we
end up having double round trips just to determine the real path.
--
Regards,
Dawit A.
"Preach what you practice, practice what you preach"
More information about the kde-core-devel
mailing list