[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: Bug#1556- Incorrect Relative URL Resolution [Was Re: Already Fixed Bugs]
From:       Dawit Alemayehu <adawit () earthlink ! net>
Date:       1999-07-28 14:27:52
[Download RAW message or body]


On Wed, 28 Jul 1999, Waldo Bastian wrote:
> >%_Dawit Alemayehu wrote:
[snipped]

> Why is an URL like //hostname/path treated like an absolute URL and not as an
> relative URL (Or did I miss something here?)? 

Ehhhhhh.... where do you see this ?  It is treated as a relative URL in my
patch as well.  Did I send the wrong patch again ....  no I did not.  Perhaps
you looked at my old patch ???

> In that case, the protocol would be determined based on the base URL instead
> of being guessed based on the hostname.

Correct. 

> According to RFC2396 section 5:
> 
>    The syntax for relative URI takes advantage of the <hier_part> syntax
>    of <absoluteURI> (Section 3) in order to express a reference that is
>    relative to the namespace of another hierarchical URI.
> 
>       relativeURI   = ( net_path | abs_path | rel_path ) [ "?" query ]
> 
>    A relative reference beginning with two slash characters is termed a
>    network-path reference, as defined by <net_path> in Section 3.  Such
>    references are rarely used.

And this is exactly what I did in my patch but missed the most obvious way
again ( simply adding pointers  !!! ) which makes the patch a one liner. 

> An URL like //www.kde.org looks to me like a perfectily valid (although
> rarily used :) network-path reference.

You mean it is only valid if a base URL is provided, right.  In other words, the
user should not be allowed to type in //www.kde.org in the location box for
example.

BTW,  I tested this on Netscape Navigator to see how they handle a user's input
; so I typed //ftp.kde.org in the location box.  When I did this there was a
local web page being displayed (The default Red Hat's Welcome Message). 
Navigator did go to KDE's ftp site, but changed the URL to file://ftp.kde.org.
in the location box.  And then I typed //www.kde.org.  This made it completely
screw up because it tries to obtain the protocol from the page currently
displayed.

If one attempts the same thing in kfm with this patch applied, they would get
"Malformed URL" error message with //www.kde.org and the correct destination
with www.kde.org.  IMHO this is the correct way to handle things.  

> What about something along the lines of the following patch?
> (I haven't tested it.)

Right.  Your patch does the same exact thing as mine except in one line.  See
previous comment.

The only other difference is that I added a filter in my patch to
KURL::parse(...) to disallow from interpreting www.kde.org URL's as
file://www.kde.org.  In fact, this would also stop a relative URL embedded in
the document from being resolved if the base URL lacks a protocol ( scheme ),
which in my interpretation of RFC 2396 section 5 is the correct way to handle
things ( base URL is required to have the scheme part ).

So then here is the new patch with one more minor change.   KURL::parser( ... )
now disallows URL's that start ":" as well .  So if a user types
://www.kde.org, s/he will get a "Malformed URL." error message.

Regards,
Dawit A.


["kurl-patch.tgz" (application/x-gzip)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic