#else
# include <strings.h>
#endif /* HAVE_STRING_H */
-#include <ctype.h>
#include <assert.h>
#include "wget.h"
static long internal_secs, internal_msecs;
#endif
+/* See the comment in gethttp() why this is needed. */
+int global_download_count;
+
void logflush PARAMS ((void));
/* From http.c. */
print_percentage (nrow * line_bytes + ndot * opt.dot_bytes + offs,
expected);
logprintf (LOG_VERBOSE, " @%s",
- rate (ndot * opt.dot_bytes + offs - initial_skip,
+ rate (ndot * opt.dot_bytes
+ + offs - (initial_skip % line_bytes),
time_offset, 1));
}
logputs (LOG_VERBOSE, "\n\n");
{
print_percentage (nrow * line_bytes, expected);
logprintf (LOG_VERBOSE, " @%s",
- rate (line_bytes - initial_skip, time_offset, 1));
+ rate (line_bytes - (initial_skip % line_bytes),
+ time_offset, 1));
}
initial_skip = 0;
logprintf (LOG_VERBOSE, "\n%5ldK", nrow * line_bytes / 1024);
assert (u->proto != URLFILE); /* #### Implement me! */
mynewloc = NULL;
+ if (u->proto == URLHTTP
#ifdef HAVE_SSL
- if (u->proto == URLHTTP || u->proto == URLHTTPS )
-#else
- if (u->proto == URLHTTP)
-#endif /* HAVE_SSL */
+ || u->proto == URLHTTPS
+#endif
+ )
result = http_loop (u, &mynewloc, dt);
else if (u->proto == URLFTP)
{
redirects, but a ton of boneheaded webservers and CGIs out
there break the rules and use relative URLs, and popular
browsers are lenient about this, so wget should be too. */
- construced_newloc = url_concat (url, mynewloc);
+ construced_newloc = uri_merge (url, mynewloc);
xfree (mynewloc);
mynewloc = construced_newloc;
goto redirected;
}
+ if (u->local)
+ {
+ if (*dt & RETROKF)
+ {
+ register_download (url, u->local);
+ if (*dt & TEXTHTML)
+ register_html (url, u->local);
+ }
+ }
+
if (file)
{
if (u->local)
else
xfree (url);
+ ++global_download_count;
+
return result;
}