PATCH:KURL

Dawit A. adawit at kde.org
Tue Apr 29 01:16:21 BST 2003


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.

- 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.

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

-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.

Regards,
Dawit A.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kurl-20030428-1.diff
Type: text/x-diff
Size: 3661 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030428/9e55ebb3/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kurltest-20030428-1.diff
Type: text/x-diff
Size: 11609 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20030428/9e55ebb3/attachment-0001.diff>


More information about the kde-core-devel mailing list