]> sjero.net Git - wget/commitdiff
opt.remote_encoding should not override opt.locale, add a force arguments to set_uri_...
authorXavier Saint <wget@sxav.eu>
Wed, 30 Jul 2008 08:15:55 +0000 (10:15 +0200)
committerXavier Saint <wget@sxav.eu>
Wed, 30 Jul 2008 08:15:55 +0000 (10:15 +0200)
src/iri.c
src/iri.h
src/main.c
src/recur.c
src/res.c
src/retr.c

index 44a262b8e25ba872153cc3724cb4aa34aa610940..3ee99871273ad76c4d115c015bcb751653e93ec3 100644 (file)
--- a/src/iri.c
+++ b/src/iri.c
@@ -329,10 +329,10 @@ iri_free (struct iri *i)
 }
 
 void
-set_uri_encoding (struct iri *i, char *charset)
+set_uri_encoding (struct iri *i, char *charset, bool force)
 {
   DEBUGP (("[IRI uri = `%s'\n", quote (charset)));
-  if (opt.encoding_remote)
+  if (!force && opt.encoding_remote)
     return;
   if (i->uri_encoding)
     {
index cdc5c7fd5bf64281ec2b23b8d3a245f5d917acb4..e7f3fe3e46eaf6172f115bd4dc147c5da7d4f255 100644 (file)
--- a/src/iri.h
+++ b/src/iri.h
@@ -47,7 +47,7 @@ char *idn_decode (char *host);
 bool remote_to_utf8 (struct iri *i, const char *str, const char **new);
 struct iri *iri_new (void);
 void iri_free (struct iri *i);
-void set_uri_encoding (struct iri *i, char *charset);
+void set_uri_encoding (struct iri *i, char *charset, bool force);
 void set_content_encoding (struct iri *i, char *charset);
 
 #else /* ENABLE_IRI */
@@ -63,7 +63,7 @@ struct iri dummy_iri;
 #define remote_to_utf8(a,b,c)       false
 #define iri_new()                   (&dummy_iri)
 #define iri_free(a)
-#define set_uri_encoding(a,b)
+#define set_uri_encoding(a,b,c)
 #define set_content_encoding(a,b)
 
 #endif /* ENABLE_IRI */
index 8cee194c8f794135e7bbb73e5e35da2baad1bf44..799e5d63b60d7e6c59f480ca6b9810115351788f 100644 (file)
@@ -1206,7 +1206,7 @@ WARNING: Can't reopen standard output in binary mode;\n\
       else
         {
           struct iri *i = iri_new ();
-          set_uri_encoding (i, opt.locale);
+          set_uri_encoding (i, opt.locale, true);
           status = retrieve_url (*t, &filename, &redirected_URL, NULL, &dt,
                                  opt.recursive, i);
           iri_free (i);
index aa83e9a6c15651a03a0961d7b8a7be9f6e33d688..19ef8f1c42bc05645fd23d0a5fba0297cf74c070 100644 (file)
@@ -202,7 +202,7 @@ retrieve_tree (const char *start_url)
   int up_error_code;
   struct url *start_url_parsed;
   struct iri *i = iri_new ();
-  set_uri_encoding (i, opt.locale);
+  set_uri_encoding (i, opt.locale, true);
 
   start_url_parsed = url_parse (start_url, &up_error_code, i);
   if (!start_url_parsed)
@@ -391,7 +391,7 @@ retrieve_tree (const char *start_url)
                                         blacklist, i))
                     {
                       ci = iri_new ();
-                      set_uri_encoding (ci, i->content_encoding);
+                      set_uri_encoding (ci, i->content_encoding, false);
                       url_enqueue (queue, ci, xstrdup (child->url->url),
                                    xstrdup (referer_url), depth + 1,
                                    child->link_expect_html,
index 69abd12dd5b60dc8d03193b3ddcd55f1003a7c63..0320d034246cfce5639397522a1a41f9789fdbb8 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -542,7 +542,7 @@ res_retrieve_file (const char *url, char **file, struct iri *iri)
 
   /* Copy server URI encoding for a possible IDNA transformation, no need to
      encode the full URI in UTF-8 because "robots.txt" is plain ASCII */
-  set_uri_encoding (i, iri->uri_encoding);
+  set_uri_encoding (i, iri->uri_encoding, false);
   i->utf8_encode = false;
 
   logputs (LOG_VERBOSE, _("Loading robots.txt; please ignore errors.\n"));
index 691b8f51a907c9f320352e0d8c295f91a40b4393..111b745a01285180509d89d6bddb3dcd26ef4538 100644 (file)
@@ -653,7 +653,7 @@ retrieve_url (const char *origurl, char **file, char **newloc,
     {
       /* sXXXav : could a proxy include a path ??? */
       struct iri *pi = iri_new ();
-      set_uri_encoding (pi, opt.locale);
+      set_uri_encoding (pi, opt.locale, true);
       pi->utf8_encode = false;
 
       /* Parse the proxy URL.  */
@@ -1083,7 +1083,7 @@ url_uses_proxy (const char *url)
   struct url *u;
   struct iri *i = iri_new();
   /* url was given in the command line, so use locale as encoding */
-  set_uri_encoding (i, opt.locale);
+  set_uri_encoding (i, opt.locale, true);
   u= url_parse (url, NULL, i);
   if (!u)
     return false;