]> sjero.net Git - wget/blobdiff - src/retr.c
[svn] Various url.c-related changes.
[wget] / src / retr.c
index 97a67246db19e8089e8821d9eec34cc3d18774ea..3aae5125324a10b1519e015f8828c0debcb06f63 100644 (file)
@@ -54,6 +54,9 @@ LARGE_INTEGER internal_time;
 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.  */
@@ -446,11 +449,11 @@ retrieve_url (const char *origurl, char **file, char **newloc,
   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)
     {
@@ -490,7 +493,7 @@ retrieve_url (const char *origurl, char **file, char **newloc,
         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;
 
@@ -546,6 +549,16 @@ retrieve_url (const char *origurl, char **file, char **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)
@@ -562,6 +575,8 @@ retrieve_url (const char *origurl, char **file, char **newloc,
   else
     xfree (url);
 
+  ++global_download_count;
+
   return result;
 }