X-Git-Url: http://sjero.net/git/?a=blobdiff_plain;f=src%2Fhttp.c;h=682258c073c3d6bf5472f99c7962b7ac5f5e1f96;hb=4aab9e8f0af29d8fb5d59746e4e5270080f95468;hp=0252d3421f07f491a59c443f50ab08aa6480d2af;hpb=e72b57629bf49cdfd663002a8bb336a67b958979;p=wget diff --git a/src/http.c b/src/http.c index 0252d342..682258c0 100644 --- a/src/http.c +++ b/src/http.c @@ -1823,10 +1823,11 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy) /* TODO: perform this check only once. */ if (!hs->existence_checked && file_exists_p (hs->local_file)) { - if (opt.noclobber) + if (opt.noclobber && !opt.output_document) { /* If opt.noclobber is turned on and file already exists, do not - retrieve the file */ + retrieve the file. But if the output_document was given, then this + test was already done and the file didn't exist. Hence the !opt.output_document */ logprintf (LOG_VERBOSE, _("\ File %s already there; not retrieving.\n\n"), quote (hs->local_file)); /* If the file is there, we suppose it's retrieved OK. */ @@ -2039,9 +2040,32 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file)); char *tmp = strchr (type, ';'); if (tmp) { +#ifdef ENABLE_IRI + char *tmp2 = tmp + 1; +#endif + 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"); @@ -2376,10 +2400,11 @@ http_loop (struct url *u, char **newloc, char **local_file, const char *referer, /* TODO: Ick! This code is now in both gethttp and http_loop, and is * screaming for some refactoring. */ - if (got_name && file_exists_p (hstat.local_file) && opt.noclobber) + if (got_name && file_exists_p (hstat.local_file) && opt.noclobber && !opt.output_document) { /* If opt.noclobber is turned on and file already exists, do not - retrieve the file */ + retrieve the file. But if the output_document was given, then this + test was already done and the file didn't exist. Hence the !opt.output_document */ logprintf (LOG_VERBOSE, _("\ File %s already there; not retrieving.\n\n"), quote (hstat.local_file));