Question about KUrl::equals/cmp...

Dawit A. adawit at kde.org
Wed Nov 4 15:59:44 GMT 2009


On Wednesday 04 November 2009 10:34:25 David Faure wrote:
> On Wednesday 04 November 2009, Dawit A. wrote:
> > Is there a reason why KUrl::equals with its second parameter set to
> > KUrl::CompareWithoutTrailingSlash or KUrl::cmp's second parameter set to
> >  true returns "http://www.kde.org/" and "http://www.kde.org" are not
> > equal to each other ?
> 
> Ah, I think I know. Tricky: with http these urls are equal, while with e.g.
> FTP they are not, since ftp://user@host redirects to
>  ftp://user@host/home/user (on a linux server), while ftp://user@host/ is
>  the root dir. Basically we treat "no path" as "please go to the default
>  starting directory". But I'm ok with an exception for HTTP, where indeed
>  people  expect these two urls to be the same.

Well I complely understand the different requirements of different protocols, 
but why would one specificy the KUrl::CompareWithoutTrailingSlash flag to make 
comparisons, like the ftp case you mentioned above, when the trailing slash is 
important ? In other words, why use the KUrl::CompareWithoutTrailingSlash flag 
in the first place in such circumstances ? 

It does not seem the correct thing to do to make exceptions in the API for a 
protocol specific need it already accomodates through existing options unless 
of course I am completely missing something. Perhaps not breaking existing 
applications that rely on the current behavior ?




More information about the kde-core-devel mailing list