>From 1caf184d4303d5a6bace04dcd80d70b6ebaff200 Mon Sep 17 00:00:00 2001
From: YX Hao <lifenjoiner@163.com>
Date: Wed, 25 Oct 2017 18:34:20 +0800
Subject: Avoid unnecessary UTF-8 encoded fallback

The worst case:
Host was solved, but wget is blocked by a firewall.
Most times, it should be stopped here, as most URLs are UTF-8 encoded.

diff --git a/src/retr.c b/src/retr.c
index a27d58af..c1bc600e 100644
--- a/src/retr.c
+++ b/src/retr.c
@@ -1098,11 +1098,16 @@ retrieve_url (struct url * orig_parsed, const char *origurl, char **file,
       u = url_parse (origurl, NULL, iri, true);
       if (u)
         {
-          DEBUGP (("[IRI fallbacking to non-utf8 for %s\n", quote (url)));
-          xfree (url);
-          url = xstrdup (u->url);
-          iri_fallbacked = 1;
-          goto redirected;
+          if (strcmp(u->url, orig_parsed->url))
+            {
+              DEBUGP (("[IRI fallbacking to non-utf8 for %s\n", quote (url)));
+              xfree (url);
+              url = xstrdup (u->url);
+              iri_fallbacked = 1;
+              goto redirected;
+            }
+          else
+              DEBUGP (("[Needn't fallback to non-utf8 for %s\n", quote (url)));
         }
       else
           DEBUGP (("[Couldn't fallback to non-utf8 for %s\n", quote (url)));
