bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [PATCH] improved Test-idn-robots.txt


From: Giuseppe Scrivano
Subject: Re: [Bug-wget] [PATCH] improved Test-idn-robots.txt
Date: Wed, 09 Oct 2013 22:08:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Tim Rühsen <address@hidden> writes:

> If i can give you a helping hand, contact me.

you have already helped a lot, you first discovered this bug :-)

If nobody complains, I will polish this patch and push it tomorrow.

I would like any big change now, I'll go trough bugs tracker in the next
days and if there is nothing blocking, I'll make a new release in the
next weeks.

Giuseppe


diff --git a/src/html-url.c b/src/html-url.c
index bb2b20e..1bb44b4 100644
--- a/src/html-url.c
+++ b/src/html-url.c
@@ -284,6 +284,10 @@ append_url (const char *link_uri, int position, int size,
   const char *base = ctx->base ? ctx->base : ctx->parent_base;
   struct url *url;
 
+  struct iri *iri = iri_new ();
+  set_uri_encoding (iri, opt.locale, true);
+  iri->utf8_encode = true;
+
   if (!base)
     {
       DEBUGP (("%s: no base, merge will use \"%s\".\n",
@@ -301,7 +305,7 @@ append_url (const char *link_uri, int position, int size,
           return NULL;
         }
 
-      url = url_parse (link_uri, NULL, NULL, false);
+      url = url_parse (link_uri, NULL, iri, false);
       if (!url)
         {
           DEBUGP (("%s: link \"%s\" doesn't parse.\n",
@@ -323,7 +327,7 @@ append_url (const char *link_uri, int position, int size,
                quote_n (2, link_uri),
                quotearg_n_style (3, escape_quoting_style, complete_uri)));
 
-      url = url_parse (complete_uri, NULL, NULL, false);
+      url = url_parse (complete_uri, NULL, iri, false);
       if (!url)
         {
           DEBUGP (("%s: merged link \"%s\" doesn't parse.\n",
@@ -334,6 +338,8 @@ append_url (const char *link_uri, int position, int size,
       xfree (complete_uri);
     }
 
+  iri_free (iri);
+
   DEBUGP (("appending %s to urlpos.\n", quote (url->url)));
 
   newel = xnew0 (struct urlpos);
diff --git a/src/url.c b/src/url.c
index bf9d697..f554432 100644
--- a/src/url.c
+++ b/src/url.c
@@ -701,7 +701,10 @@ url_parse (const char *url, int *error, struct iri *iri, 
bool percent_encode)
       if (!iri->utf8_encode)
         new_url = NULL;
       else
-        iri->orig_url = xstrdup (url);
+        {
+          iri->orig_url = xstrdup (url);
+          percent_encode = true;
+        }
     }
 
   /* XXX XXX Could that change introduce (security) bugs ???  XXX XXX*/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]