]> sjero.net Git - wget/commitdiff
Automated merge.
authorXavier Saint <wget@sxav.eu>
Thu, 14 Aug 2008 16:45:13 +0000 (18:45 +0200)
committerXavier Saint <wget@sxav.eu>
Thu, 14 Aug 2008 16:45:13 +0000 (18:45 +0200)
1  2 
src/main.c
src/recur.c
src/retr.c

diff --combined src/main.c
index ef01b1bdc1a954da4f1a5c60ff31065d98aa2614,8d8d93fa0e1e24420c21a16378eedcf5511a3568..7c7be1c740484192bac7235d113ed5c2f06d1c6d
@@@ -163,7 -163,6 +163,7 @@@ static struct cmdline_option option_dat
      { "cookies", 0, OPT_BOOLEAN, "cookies", -1 },
      { "cut-dirs", 0, OPT_VALUE, "cutdirs", -1 },
      { WHEN_DEBUG ("debug"), 'd', OPT_BOOLEAN, "debug", -1 },
 +    { "default-page", 0, OPT_VALUE, "defaultpage", -1 },
      { "delete-after", 0, OPT_BOOLEAN, "deleteafter", -1 },
      { "directories", 0, OPT_BOOLEAN, "dirstruct", -1 },
      { "directory-prefix", 'P', OPT_VALUE, "dirprefix", -1 },
@@@ -517,9 -516,6 +517,9 @@@ HTTP options:\n")
         --http-password=PASS    set http password to PASS.\n"),
      N_("\
         --no-cache              disallow server-cached data.\n"),
 +    N_ ("\
 +       --default-page=NAME     Change the default page name (normally\n\
 +                               this is `index.html'.).\n"),
      N_("\
    -E,  --html-extension        save HTML documents with `.html' extension.\n"),
      N_("\
@@@ -1200,7 -1196,7 +1200,7 @@@ WARNING: Can't reopen standard output i
            if (url_scheme (*t) == SCHEME_FTP)
              opt.follow_ftp = 1;
  
-           status = retrieve_tree (*t);
+           status = retrieve_tree (*t, NULL);
  
            opt.follow_ftp = old_follow_ftp;
          }
diff --combined src/recur.c
index 119896ce4431bbf1088951a57b8731e123b46f6c,921c60c787848c1315847d096d8ab6fe6b511a91..a0bb86818d28bd53fbbd6882ee876a9a7f970e6b
@@@ -187,7 -187,7 +187,7 @@@ static bool descend_redirect_p (const c
            options, add it to the queue. */
  
  uerr_t
- retrieve_tree (const char *start_url)
+ retrieve_tree (const char *start_url, struct iri *pi)
  {
    uerr_t status = RETROK;
  
    int up_error_code;
    struct url *start_url_parsed;
    struct iri *i = iri_new ();
-   set_uri_encoding (i, opt.locale, true);
+ #define COPYSTR(x)  (x) ? xstrdup(x) : NULL;
+   /* Duplicate pi struct if not NULL */
+   if (pi)
+     {
+       i->uri_encoding = COPYSTR (pi->uri_encoding);
+       i->content_encoding = COPYSTR (pi->content_encoding);
+       i->utf8_encode = pi->utf8_encode;
+     }
+   else
+     set_uri_encoding (i, opt.locale, true);
+ #undef COPYSTR
  
    start_url_parsed = url_parse (start_url, &up_error_code, i);
    if (!start_url_parsed)
      {
 -      logprintf (LOG_NOTQUIET, "%s: %s.\n", start_url,
 -                 url_error (up_error_code));
 +      char *error = url_error (start_url, up_error_code);
 +      logprintf (LOG_NOTQUIET, "%s: %s.\n", start_url, error);
 +      xfree (error);
        return URLERROR;
      }
  
diff --combined src/retr.c
index c79410ff893aa406a77cc3a10bb750464c8c0d3b,963d50442b3cb861ca89ca36bf6be36f9a3816e2..0aa95072777b370475705b657568c78ee51983c6
@@@ -629,10 -629,8 +629,10 @@@ retrieve_url (const char *origurl, cha
    u = url_parse (url, &up_error_code, iri);
    if (!u)
      {
 -      logprintf (LOG_NOTQUIET, "%s: %s.\n", url, url_error (up_error_code));
 +      char *error = url_error (url, up_error_code);
 +      logprintf (LOG_NOTQUIET, "%s: %s.\n", url, error);
        xfree (url);
 +      xfree (error);
        return URLERROR;
      }
  
    proxy = getproxy (u);
    if (proxy)
      {
-       /* sXXXav : could a proxy include a path ??? */
        struct iri *pi = iri_new ();
        set_uri_encoding (pi, opt.locale, true);
        pi->utf8_encode = false;
        proxy_url = url_parse (proxy, &up_error_code, NULL);
        if (!proxy_url)
          {
 +          char *error = url_error (proxy, up_error_code);
            logprintf (LOG_NOTQUIET, _("Error parsing proxy URL %s: %s.\n"),
 -                     proxy, url_error (up_error_code));
 +                     proxy, error);
            xfree (url);
 +          xfree (error);
            RESTORE_POST_DATA;
            return PROXERR;
          }
        newloc_parsed = url_parse (mynewloc, &up_error_code, iri);
        if (!newloc_parsed)
          {
 +          char *error = url_error (mynewloc, up_error_code);
            logprintf (LOG_NOTQUIET, "%s: %s.\n", escnonprint_uri (mynewloc),
 -                     url_error (up_error_code));
 +                     error);
            url_free (u);
            xfree (url);
            xfree (mynewloc);
 +          xfree (error);
            RESTORE_POST_DATA;
            return result;
          }
@@@ -864,6 -857,7 +863,7 @@@ retrieve_from_file (const char *file, b
    *count = 0;                  /* Reset the URL count.  */
  
    /* sXXXav : Assume filename and links in the file are in the locale */
+   set_uri_encoding (iri, opt.locale, true);
    set_content_encoding (iri, opt.locale);
  
    if (url_has_scheme (url))
            status = QUOTEXC;
            break;
          }
+       /* Reset UTF-8 encode status */
+       iri->utf8_encode = opt.enable_iri;
        if ((opt.recursive || opt.page_requisites)
            && (cur_url->url->scheme != SCHEME_FTP || getproxy (cur_url->url)))
          {
            if (cur_url->url->scheme == SCHEME_FTP)
              opt.follow_ftp = 1;
  
-           status = retrieve_tree (cur_url->url->url);
+           status = retrieve_tree (cur_url->url->url, iri);
  
            opt.follow_ftp = old_follow_ftp;
          }
@@@ -934,6 -932,8 +938,8 @@@ Removing file due to --delete-after in 
    /* Free the linked list of URL-s.  */
    free_urlpos (url_list);
  
+   iri_free (iri);
    return status;
  }