diff -pru dillo/src/url.c dillo.teste/src/url.c
--- dillo/src/url.c	Fri Aug 31 00:12:44 2001
+++ dillo.teste/src/url.c	Thu Sep  6 23:56:37 2001
@@ -72,16 +72,25 @@ static void Url_init(DilloUrl *url)
    url->scrolling_position = 0;
 }
 
-
+/*
+ *  Given an URL string which is _not_ an absolute URL, and a base url,
+ *  returns the absolute version of the relative URL.
+ *  It's ugly, but it's kinda of hard to make a generic implementation
+ *  to satisfy RFC 2396 (Uniform Resource Identifiers (URI), see Section 5)
+ */
 static gchar *
  Url_str_resolve_relative(const gchar *urlstring, const gchar *BaseUrl)
 {
-   guint i;
+   guint i, base_protocol_index;
    gchar *ptr, *tmp, *base_url;
 
    for (i = 0; BaseUrl[i] && BaseUrl[i] != ':'; i++);
    for (i++; BaseUrl[i] && BaseUrl[i] == '/'; i++);
-   for (i++; BaseUrl[i] && BaseUrl[i] != '/'; i++);
+   base_protocol_index = i;
+   if (g_strncasecmp(DILLO_URL_FILE_PROTOCOL, BaseUrl, 4))
+      for (i++; BaseUrl[i] && BaseUrl[i] != '/'; i++);
+   else
+      --i;
    
    if ( (ptr = Url_str_parse_hash(BaseUrl)) )
       base_url = g_strndup(BaseUrl, ptr - BaseUrl);
@@ -89,18 +98,25 @@ static gchar *
       base_url = (gchar *)BaseUrl;
 
    if (urlstring[0] == '/' ) {
-      if (i && base_url[i]) {
-         gchar *base_host = g_strndup(base_url, i);
-         tmp = g_strconcat(base_host, urlstring, NULL);
-         g_free(base_host);
-      } else
-         tmp = g_strconcat(base_url, urlstring, NULL);
+      if (urlstring[1] == '/') {
+	 gchar *base_protocol_str = g_strndup(BaseUrl, base_protocol_index);
+	 tmp = g_strconcat(base_protocol_str, urlstring+2, NULL);
+	 g_free(base_protocol_str);
+      }
+      else {
+	 if (i && base_url[i]) {
+	    gchar *base_host = g_strndup(base_url, i);
+	    tmp = g_strconcat(base_host, urlstring, NULL);
+	    g_free(base_host);
+	 } else
+	    tmp = g_strconcat(base_url, urlstring, NULL);
+      }
 
    } else {
       if (urlstring[0] == '#') 
          tmp = g_strconcat(base_url, urlstring, NULL);
       else {
-         if ( base_url[i] && (ptr = strrchr(base_url, '/')) ) {
+	 if ( (ptr = strrchr(base_url, '/')) && *(ptr-1) != '/' ) { 
             ptr = g_strndup(base_url, ptr - base_url);
             tmp = g_strconcat(ptr, "/", urlstring, NULL);
             g_free(ptr);

