PATCH:KURL

Waldo Bastian bastian at kde.org
Tue Apr 29 09:30:19 BST 2003


On Tuesday 29 April 2003 00:16, Dawit A. wrote:
> Hi,
>
> The attached patch addresses the following issues:
>
> - Due to commit r1.235 KURL now supports file://<hostname> format, i.e. it
> does not automatically remove the hostname component of a local URL.
> However, ::isValid() was not updated to reflect this change.

How should it be updated? How does your patch update this?

> - Due to the above change we need to make KURL consistent in how it deals
> with the file protocol. The changes in both ::url and ::prettyURL do
> exactly that by returning file:/// by default instead of file:/.  This way
> not only are we consistent in how the file protocol is supported, but we
> are also compatible Mozilla and old Netscape (I think) which support this
> legacy behavior from RFC 1738.

Using file:/// is needless obscure.

> - ::isEmpty() needs to use protocol() instead of directly referring to
> m_strProtocol because m_strProtocol can contain a string if the URL is
> malformed.

Your point? A malformed URL is not empty.

> -Added a validate() (better name ?) function to give developers who
> manually construct a KURL object the chance to make sure what they
> constructed is a valid URL.
>
> Why is this needed ? Because isValid() always returns false on all manually
> constructed URLs.  Besides, manually constructing URLs, i.e. by-passing the
> parser, might be convenient, but is one of the surest ways to construct
> invalid URLs.  This function is intended to insure that will not happen
> without forcing the developer or changing all the mutator functions to
> perform parsing whenever they are asked to mutate the current state.

The correct solution would be to update m_bIsMalformed automatically when 
functions are called that manipulate the URL.

Cheers,
Waldo
-- 
bastian at kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian at suse.com





More information about the kde-core-devel mailing list