]> sjero.net Git - wget/commitdiff
[svn] Don't use the now-obsolete TYPE variable.
authorhniksic <devnull@localhost>
Tue, 20 Nov 2001 16:03:41 +0000 (08:03 -0800)
committerhniksic <devnull@localhost>
Tue, 20 Nov 2001 16:03:41 +0000 (08:03 -0800)
Published in <sxswv0ledyx.fsf@florida.arsdigita.de>.

src/ChangeLog
src/url.c

index d415ea992d3d637aade89237a61f3fc632035108..24b227770a3061df00f9d345a09414824892a76c 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-20  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * url.c (parseurl): Don't depend on the now-obsolete TYPE.
+
 2001-11-19  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * url.c (getproxy): Handle URL shorthands.
index 82b21d0ca0359805a1f39f41a413180d6753390d..30310904df6f6d3d78a1b21c9fcfd75b59bf6faf 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -423,7 +423,7 @@ parseurl (const char *url, struct urlinfo *u, int strict)
                                  the scheme was explicitly named,
                                  i.e. it wasn't deduced from the URL
                                  format.  */
-  uerr_t type;
+  uerr_t type = URLUNKNOWN;
 
   DEBUGP (("parseurl (\"%s\") -> ", url));
   recognizable = url_has_scheme (url);
@@ -442,7 +442,17 @@ parseurl (const char *url, struct urlinfo *u, int strict)
   else if (i == ARRAY_SIZE (supported_schemes))
     type = URLUNKNOWN;
   else
-    u->scheme = type = supported_schemes[i].scheme;
+    {
+      u->scheme = supported_schemes[i].scheme;
+      if (u->scheme == SCHEME_HTTP)
+       type = URLHTTP;
+#ifdef HAVE_SSL
+      if (u->scheme == SCHEME_HTTPS)
+       type = URLHTTPS;
+#endif
+      if (u->scheme == SCHEME_FTP)
+       type = URLFTP;
+    }
 
   if (type == URLUNKNOWN)
     l = 0;
@@ -505,12 +515,12 @@ parseurl (const char *url, struct urlinfo *u, int strict)
   /* Some delimiter troubles...  */
   if (url[i] == '/' && url[i - 1] != ':')
     ++i;
-  if (type == URLHTTP)
+  if (u->scheme == SCHEME_HTTP)
     while (url[i] && url[i] == '/')
       ++i;
   u->path = (char *)xmalloc (strlen (url + i) + 8);
   strcpy (u->path, url + i);
-  if (type == URLFTP)
+  if (u->scheme == SCHEME_FTP)
     {
       u->ftp_type = process_ftp_type (u->path);
       /* #### We don't handle type `d' correctly yet.  */
@@ -534,7 +544,7 @@ parseurl (const char *url, struct urlinfo *u, int strict)
   /* Simplify the directory.  */
   path_simplify (u->dir);
   /* Remove the leading `/' in HTTP.  */
-  if (type == URLHTTP && *u->dir == '/')
+  if (u->scheme == SCHEME_HTTP && *u->dir == '/')
     strcpy (u->dir, u->dir + 1);
   DEBUGP (("ndir %s\n", u->dir));
   /* Strip trailing `/'.  */