[TransWarp] Testing Help Needed: URL contexts

Phillip J. Eby pje at telecommunity.com
Mon May 19 18:45:54 EDT 2003


At 10:13 PM 5/19/03 +0300, alexander smishlajev wrote:
>Phillip J. Eby wrote:
>>I just checked in a replacement for the old URL parsing mechanisms in 
>>PEAK, and I could really use some help with validating that the existing 
>>supported schemes are parsed correctly by the current CVS version of PEAK.
>
>FileURL does incorrectrly handle relative paths.

Technically, a relative path is not a valid 'file:' URL, and I've decided 
not to support this.  What I'm doing is that any place PEAK expects to find 
a "URL or filename", I will have PEAK convert the relative path to an 
absolute one, and from there to a 'file:' URL.  This morning, I added a 
'fromFilename()' method to 'FileURL' that does this conversion.

The correct mechanism for relative paths to use is a relative URI, not a 
schemed URI.  In other words href="./egg?warning" is a valid relative URI 
href, but href="file:./egg?warning" is invalid.



>the first two examples are formatted differently from original source 
>(formatting always adds "//" after the scheme component), but i am not 
>sure if this may be called "incorrect formatting" since the url meaning 
>does not change.

Actually, the URLs you gave are not quite correct, because '//' at the 
beginning of a file URL is an indication that a *hostname* follows.

Nonetheless, I really appreciate your efforts on this.  I probably do need 
to make some adjustments so that invalid 'file:' URLs are identified as 
such.  That is, 'file:' URLs should be required to be absolute, and 
relative filenames should be an error.




More information about the PEAK mailing list