Hi, I'm using wget-1.7 and found a problem with uri_merge on slashdot
pages.

Basically, slashdot likes to use something like
    <IMG SRC="//images.slashdot.org/topics/topicwine.gif">
Since the referring page is "http://slashdot.org/topics.shtml";,
uri_merge returns
"http://slashdot.org//images.slashdot.org/topics/topicwine.gif";, instead
of the correct "http://images.slashdot.org/topics/topicwine.gif";.

I made some simeple changes to url.c to handle this problem. Thought
you'd like to know.

Cheers.
= Q. Alex Zhao
  http://www.cc.gatech.edu/~qiang.a.zhao/
  mailto:[EMAIL PROTECTED] voiceto:404-385-2447 faxto:404-385-1253
  Graphics, Visualization & Usability Center, Georgia Inst. of Tech.

---------- PATCH ----------
--- src/url.c.orig      Sun May 27 15:35:10 2001
+++ src/url.c   Sun Sep 30 12:08:47 2001
@@ -1195,6 +1195,7 @@
          constr[span + linklength] = '\0';
        }
       else /* *link == `/' */
+      if (*(link + 1) != '/')
        {
          /* LINK is an absolute path: we need to replace everything
              after (and including) the FIRST slash with LINK.
@@ -1249,6 +1250,12 @@
          if (linklength)
            memcpy (constr + span, link, linklength);
          constr[span + linklength] = '\0';
+       } else {
+          /* LINK starts with "//", just put "http:" in front of it */
+         constr = (char *)xmalloc (linklength + 6);
+         memcpy (constr, "http:", 5);
+         memcpy (constr + 5, link, linklength);
+         constr[linklength + 5] = '\0';
        }
     }
   else /* !no_proto */

Reply via email to