]> sjero.net Git - wget/commitdiff
[svn] Committed my patch <dpem6hln1k.fsf@mraz.iskon.hr>.
authorhniksic <devnull@localhost>
Thu, 1 Jun 2000 10:47:03 +0000 (03:47 -0700)
committerhniksic <devnull@localhost>
Thu, 1 Jun 2000 10:47:03 +0000 (03:47 -0700)
src/ChangeLog
src/url.c

index fa01e18df462bd998c0158ea363ce4620867b2d2..a95781f36ade369626b1e200aeb831b320eb2eb9 100644 (file)
@@ -1,3 +1,8 @@
+2000-06-01  Hrvoje Niksic  <hniksic@iskon.hr>
+
+       * url.c (str_url): Print the port number only if it's different
+       from the default port number for that protocol.
+
 2000-05-22  Dan Harkless  <dan-wget@dilvish.speed.net>
 
        * main.c (main): Added --help line for Damir Dzeko
index a5ab4316cf01a5025f7f3f79c98d35c56b37e108..042835fdfaef2455b4d76c3d3f3e5c85a24834ba 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -631,6 +631,7 @@ str_url (const struct urlinfo *u, int hide)
 {
   char *res, *host, *user, *passwd, *proto_name, *dir, *file;
   int i, l, ln, lu, lh, lp, lf, ld;
+  unsigned short proto_default_port;
 
   /* Look for the protocol name.  */
   for (i = 0; i < ARRAY_SIZE (sup_protos); i++)
@@ -639,6 +640,7 @@ str_url (const struct urlinfo *u, int hide)
   if (i == ARRAY_SIZE (sup_protos))
     return NULL;
   proto_name = sup_protos[i].name;
+  proto_default_port = sup_protos[i].port;
   host = CLEANDUP (u->host);
   dir = CLEANDUP (u->dir);
   file = CLEANDUP (u->file);
@@ -693,9 +695,12 @@ str_url (const struct urlinfo *u, int hide)
     }
   memcpy (res + l, host, lh);
   l += lh;
-  res[l++] = ':';
-  long_to_string (res + l, (long)u->port);
-  l += numdigit (u->port);
+  if (u->port != proto_default_port)
+    {
+      res[l++] = ':';
+      long_to_string (res + l, (long)u->port);
+      l += numdigit (u->port);
+    }
   res[l++] = '/';
   memcpy (res + l, dir, ld);
   l += ld;