]> sjero.net Git - wget/blobdiff - src/recur.c
Removed commented *printf and use quote_n() for quoting several args
[wget] / src / recur.c
index 119896ce4431bbf1088951a57b8731e123b46f6c..786824583c1553fd66254ac3c4fae055f8799e56 100644 (file)
@@ -115,8 +115,8 @@ url_enqueue (struct url_queue *queue, struct iri *i,
   DEBUGP (("Queue count %d, maxcount %d.\n", queue->count, queue->maxcount));
 
   if (i)
-    DEBUGP (("[IRI Enqueuing %s with %s\n", quote (url),
-             i->uri_encoding ? quote (i->uri_encoding) : "None"));
+    DEBUGP (("[IRI Enqueuing %s with %s\n", quote_n (0, url),
+             i->uri_encoding ? quote_n (1, i->uri_encoding) : "None"));
 
   if (queue->tail)
     queue->tail->next = qel;
@@ -187,7 +187,7 @@ static bool descend_redirect_p (const char *, const char *, int,
           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;
 
@@ -201,7 +201,18 @@ 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, 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)