[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
From:       Waldo Bastian <bastian () ens ! ascom ! ch>
Date:       1999-07-28 8:55:55
[Download RAW message or body]

Dawit Alemayehu wrote:
> 
> Greetings,
> 
> On Mon, 26 Jul 1999, Waldo Bastian wrote:
> > Dawit Alemayehu wrote:
> >
> > > Anyways,  I have included the patch for anyone interested in giving it a try.
> > > I really would appreciate the feedback.  I can also ask the bug reporter to
> > > try the patch if he built KDE out of the source.  To test the patch, please
> > > have look at
> > >
> > >         http://www.glinx.com/~hclsmith/
> > >
> > > before and after you apply the patch. PLEASE NOTE that this patch is only for
> > > KDE_1_1_BRANCH.  KURL in the head branch has been re-designed ( much more
> > > cleanly I might add ).  However, it still does not handle ( at least KURL
> > > by itself ) pages like the one mentioned above.  But before fixing the one in
> > > the head branch, I want to discuss the options as there are several available.
> > > This is what I meant above by "it is an entirely different topic" above.
> >
> > What is this patch supposed to fix?  the patch looks very dirty to me.
> 
> Okay Waldo.  You hurt my ego so it went and read RFC 1808 and came up with
> a very clean code to fix this bug.  It told me to post it or else it will hijack
> my whole brain so for fear of retribution I have attached it below.  :-)
> 
> Thanks for encouraging it.  Now it won't leave my poor brain alone .... :-))))
> 
> Regards,
> Dawit A.

Why is an URL like //hostname/path treated like an absolute URL and not as an
relative URL (Or did I miss something here?)? In that case, the protocol would
be determined based on the base URL instead of being guessed based on the
hostname.

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.

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

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

Cheers,
Waldo
-- 
The "gui" in "Penguin" is pronounced "K-D-E"
["kurl-waba-990728.diff" (text/plain)]

--- kurl.cpp.orig	Wed Jul 28 10:47:13 1999
+++ kurl.cpp	Wed Jul 28 10:51:24 1999
@@ -151,21 +151,27 @@
     else
     {
 	// Relative URL
-
-        malformed = _base_url.malformed;
-        protocol_part = _base_url.protocol_part;
-        host_part = _base_url.host_part;
-        port_number = _base_url.port_number;
-        path_part = _base_url.path_part;
-        path_part_decoded = _base_url.path_part_decoded;
-        ref_part = _base_url.ref_part;
-        dir_part = _base_url.dir_part;
-        user_part = _base_url.user_part;
-        passwd_part = _base_url.passwd_part;
-        bNoPath = _base_url.bNoPath;
-        detach();
-
-	cd( _rel_url );
+	if (strncmp ( "//", _rel_url, 2 ) == 0)
+	{
+	    parse( _base_url.protocol_part+":"+_rel_url);
+	}
+	else
+	{
+	    malformed = _base_url.malformed;
+	    protocol_part = _base_url.protocol_part;
+	    host_part = _base_url.host_part;
+	    port_number = _base_url.port_number;
+	    path_part = _base_url.path_part;
+	    path_part_decoded = _base_url.path_part_decoded;
+	    ref_part = _base_url.ref_part;
+	    dir_part = _base_url.dir_part;
+	    user_part = _base_url.user_part;
+	    passwd_part = _base_url.passwd_part;
+	    bNoPath = _base_url.bNoPath;
+	    detach();
+	    
+	    cd( _rel_url );
+	}
     } 
 }
 


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

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