]> sjero.net Git - wget/commitdiff
Detect HTTP Content-Type server encoding
authorSaint Xavier <wget@sxav.eu>
Sun, 25 May 2008 01:49:00 +0000 (03:49 +0200)
committerSaint Xavier <wget@sxav.eu>
Sun, 25 May 2008 01:49:00 +0000 (03:49 +0200)
src/http.c

index 11dc9cc8f7d08c2678e09a486f135e21118e16de..682258c073c3d6bf5472f99c7962b7ac5f5e1f96 100644 (file)
@@ -2040,9 +2040,32 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
       char *tmp = strchr (type, ';');
       if (tmp)
         {
       char *tmp = strchr (type, ';');
       if (tmp)
         {
+#ifdef ENABLE_IRI
+          char *tmp2 = tmp + 1;
+#endif
+
           while (tmp > type && c_isspace (tmp[-1]))
             --tmp;
           *tmp = '\0';
           while (tmp > type && c_isspace (tmp[-1]))
             --tmp;
           *tmp = '\0';
+
+#ifdef ENABLE_IRI
+          if (opt.enable_iri && *tmp2 != '\0' &&
+              (tmp = strstr (tmp2, "charset=")) != NULL)
+            {
+              tmp += 8;
+              tmp2 = tmp;
+
+              while (*tmp2 && !c_isspace (*tmp2))
+                tmp2++;
+
+              if (tmp2 > tmp)
+                {
+                  *tmp2 = '\0';
+                  /* sXXXav : check given charset */
+                  logprintf (LOG_VERBOSE, "HTTP charset: `%s'\n", tmp);
+                }
+            }
+#endif
         }
     }
   hs->newloc = resp_header_strdup (resp, "Location");
         }
     }
   hs->newloc = resp_header_strdup (resp, "Location");