changeset 207:cf4098008615

2003-7-1 Brian Masney <masneyb@gftp.org> * lib/httpcommon.h lib/rfc2068.c - more HTTP improvements. Mostly with chunked file transfers. Also fixed several memory leaks. Added more informative error messages to aid in debugging. Size parsing fixes * lib/misc.c (base64_encode) - alphabet fix (+ wasn't a valid character, it should have been /) (thanks to Holger Kiehl <Holger.Kiehl@dwd.de> for pointing this out) * lib/config_file.c lib/gftp.h - added copy function for options variables. The functions gftp_config_file_copy_text(), gftp_config_file_copy_ptr_contents() and gftp_config_file_copy_color() were added * lib/protocols.c - make sure the remote_charsets string is restored properly after it is used * src/gtk/bookmarks.c - remove memory leak comments, these are fixed now * src/gtk/transfer.c - removed start_file_transfers variable * src/gtk/misc-gtk.c src/gtk/gftp-gtk.h lib/misc.c lib/gftp.h - moved get_next_selection() to lib * acinclude.h (AC_TYPE_SOCKLEN_T) - AC_DEFINE fix (from Nathan Robertson <nathanr@nathanr.net>)
author masneyb
date Wed, 02 Jul 2003 01:44:57 +0000
parents 5ef3a4c3b19a
children 86a3e0da176d
files ChangeLog acinclude.m4 lib/config_file.c lib/gftp.h lib/httpcommon.h lib/misc.c lib/protocols.c lib/rfc2068.c src/gtk/bookmarks.c src/gtk/gftp-gtk.h src/gtk/misc-gtk.c src/gtk/transfer.c src/text/gftp-text.c
diffstat 13 files changed, 248 insertions(+), 118 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jun 28 13:52:44 2003 +0000
+++ b/ChangeLog	Wed Jul 02 01:44:57 2003 +0000
@@ -1,3 +1,33 @@
+2003-07-01  gettextize  <bug-gnu-gettext@gnu.org>
+
+	* Makefile.am (SUBDIRS): Add intl.
+	(EXTRA_DIST): Add config.rpath mkinstalldirs.
+	* configure.in (AC_OUTPUT): Add intl/Makefile,
+
+2003-7-1 Brian Masney <masneyb@gftp.org>
+	* lib/misc.c (base64_encode) - alphabet fix (+ wasn't a valid
+	character, it should have been /) (thanks to Holger Kiehl
+	<Holger.Kiehl@dwd.de> for pointing this out)
+
+	* lib/config_file.c lib/gftp.h - added copy function for options
+	variables. The functions gftp_config_file_copy_text(), 
+	gftp_config_file_copy_ptr_contents() and gftp_config_file_copy_color()
+	were added
+
+	* lib/protocols.c - make sure the remote_charsets string is restored
+	properly after it is used
+
+	* src/gtk/bookmarks.c - remove memory leak comments, these are fixed
+	now
+
+	* src/gtk/transfer.c - removed start_file_transfers variable
+
+	* src/gtk/misc-gtk.c src/gtk/gftp-gtk.h lib/misc.c lib/gftp.h - moved
+	get_next_selection() to lib
+
+	* acinclude.h (AC_TYPE_SOCKLEN_T) - AC_DEFINE fix (from
+	Nathan Robertson <nathanr@nathanr.net>)
+
 2003-6-25 Brian Masney <masneyb@gftp.org>
 	* lib/misc.c (expand_path) - small improvements
 
@@ -1134,7 +1164,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.103 2003/06/26 02:14:22 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.104 2003/07/02 01:44:54 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/acinclude.m4	Sat Jun 28 13:52:44 2003 +0000
+++ b/acinclude.m4	Wed Jul 02 01:44:57 2003 +0000
@@ -125,7 +125,7 @@
    #include <sys/types.h>
    #include <sys/socket.h>], [socklen_t x = 5;],
      [AC_MSG_RESULT(yes)],
-     [AC_DEFINE(socklen_t,int)
+     [AC_DEFINE(socklen_t,int,Need to define socklen_t as an int because it should be in sys/socket.h)
       AC_MSG_RESULT(no)])
   ])
 
--- a/lib/config_file.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/lib/config_file.c	Wed Jul 02 01:44:57 2003 +0000
@@ -915,6 +915,28 @@
 }
 
 
+static void
+gftp_config_file_copy_text (gftp_config_vars * cv, gftp_config_vars * dest_cv)
+{
+  if (dest_cv->flags & GFTP_CVARS_FLAGS_DYNMEM && dest_cv->value != NULL)
+    g_free (dest_cv->value);
+
+  if (cv->value != NULL)
+    {
+      dest_cv->value = g_strdup ((char *) cv->value);
+      dest_cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
+    }
+  else
+    dest_cv->value = NULL;
+}
+
+
+static void
+gftp_config_file_copy_ptr_contents (gftp_config_vars * cv, gftp_config_vars * dest_cv)
+{
+  memcpy (&dest_cv->value, &cv->value, sizeof (dest_cv->value));
+}
+
 static int
 gftp_config_file_read_int (char *str, gftp_config_vars * cv, int line)
 {
@@ -998,6 +1020,18 @@
 }
 
 
+static void
+gftp_config_file_copy_color (gftp_config_vars * cv, gftp_config_vars * dest_cv)
+{
+  if (dest_cv->flags & GFTP_CVARS_FLAGS_DYNMEM && dest_cv->value != NULL)
+    g_free (dest_cv->value);
+
+  dest_cv->value = g_malloc (sizeof (gftp_color));
+  memcpy (dest_cv->value, cv->value, sizeof (gftp_color));
+  dest_cv->flags |= GFTP_CVARS_FLAGS_DYNMEM;
+}
+
+
 static int
 gftp_config_file_read_intcombo (char *str, gftp_config_vars * cv, int line)
 {
@@ -1064,15 +1098,15 @@
 /* Note, the index numbers of this array must match up to the numbers in
    gftp_option_type_enum in gftp.h */
 gftp_option_type_var gftp_option_types[] = {
-  {gftp_config_file_read_text, gftp_config_file_write_text, NULL, NULL, NULL},
-  {gftp_config_file_read_textcombo, gftp_config_file_write_text, NULL, NULL, NULL},
-  {gftp_config_file_read_text, gftp_config_file_write_text, NULL, NULL, NULL},
-  {gftp_config_file_read_text, gftp_config_file_write_hidetext, NULL, NULL, NULL},
-  {gftp_config_file_read_int, gftp_config_file_write_int, NULL, NULL, NULL},
-  {gftp_config_file_read_checkbox, gftp_config_file_write_int, NULL, NULL, NULL},
-  {gftp_config_file_read_intcombo, gftp_config_file_write_intcombo, NULL, NULL, NULL},
-  {gftp_config_file_read_float, gftp_config_file_write_float, NULL, NULL, NULL},
-  {gftp_config_file_read_color, gftp_config_file_write_color, NULL, NULL, NULL},
+  {gftp_config_file_read_text, gftp_config_file_write_text, gftp_config_file_copy_text, NULL, NULL, NULL},
+  {gftp_config_file_read_textcombo, gftp_config_file_write_text, gftp_config_file_copy_text, NULL, NULL, NULL},
+  {gftp_config_file_read_text, gftp_config_file_write_text, gftp_config_file_copy_text, NULL, NULL, NULL},
+  {gftp_config_file_read_text, gftp_config_file_write_hidetext, gftp_config_file_copy_text, NULL, NULL, NULL},
+  {gftp_config_file_read_int, gftp_config_file_write_int, gftp_config_file_copy_ptr_contents, NULL, NULL, NULL},
+  {gftp_config_file_read_checkbox, gftp_config_file_write_int, gftp_config_file_copy_ptr_contents, NULL, NULL, NULL},
+  {gftp_config_file_read_intcombo, gftp_config_file_write_intcombo, gftp_config_file_copy_ptr_contents, NULL, NULL, NULL},
+  {gftp_config_file_read_float, gftp_config_file_write_float, gftp_config_file_copy_ptr_contents, NULL, NULL, NULL},
+  {gftp_config_file_read_color, gftp_config_file_write_color, gftp_config_file_copy_color, NULL, NULL, NULL},
   {NULL, NULL, NULL, NULL, NULL},
   {NULL, NULL, NULL, NULL, NULL}
 };
@@ -1204,8 +1238,11 @@
     {
       g_hash_table_insert (*new_options_hash, (*new_options_vars)[i].key,
                            &(*new_options_vars)[i]);
+      
+      (*new_options_vars)[i].value = NULL;
+      (*new_options_vars)[i].flags &= ~GFTP_CVARS_FLAGS_DYNMEM;
 
-      /* FIXME 2.0.15 - copy option values */
+      gftp_option_types[(*new_options_vars)[i].otype].copy_function (&(orig_options)[i], &(*new_options_vars)[i]);
     }
 }
 
@@ -1285,5 +1322,7 @@
       tempentry = tempentry->next;
       g_free (delentry);
     }
+
+  g_free (bookmarks);
 }
 
--- a/lib/gftp.h	Sat Jun 28 13:52:44 2003 +0000
+++ b/lib/gftp.h	Wed Jul 02 01:44:57 2003 +0000
@@ -294,6 +294,7 @@
 {
   int (*read_function) (char *str, gftp_config_vars * cv, int line);
   int (*write_function) (gftp_config_vars * cv, FILE * fd, int to_config_file);
+  void (*copy_function) (gftp_config_vars * cv, gftp_config_vars * dest_cv);
   void * (*ui_print_function) (gftp_config_vars * cv, void *user_data);
   void (*ui_save_function) (gftp_config_vars * cv, void *user_data);
   void (*ui_cancel_function) (gftp_config_vars * cv, void *user_data);
@@ -713,6 +714,10 @@
 
 void gftp_shutdown			( void );
 
+GList * get_next_selection 		( GList * selection, 
+					  GList ** list, 
+					  int *curnum );
+
 /* protocols.c */
 #define GFTP_FTP_NUM				0
 #define GFTP_HTTP_NUM				1
--- a/lib/httpcommon.h	Sat Jun 28 13:52:44 2003 +0000
+++ b/lib/httpcommon.h	Wed Jul 02 01:44:57 2003 +0000
@@ -23,14 +23,16 @@
 {
   gftp_getline_buffer * rbuf;
   unsigned long read_bytes,
-                content_length,
-                chunk_size;
+                content_length;
+  long chunk_size;
   unsigned int chunked_transfer : 1;
   ssize_t (*real_read_function) ( gftp_request * request,
                                   void *ptr,
                                   size_t size,
                                   int fd );
 
+  char * extra_read_buffer;
+  size_t extra_read_buffer_len;
 } rfc2068_params;
 
 int rfc2068_get_next_file 			( gftp_request * request,
--- a/lib/misc.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/lib/misc.c	Wed Jul 02 01:44:57 2003 +0000
@@ -967,7 +967,7 @@
     table[i + 52] = '0' + i;
 
   table[62] = '+';
-  table[63] = '-';
+  table[63] = '/';
 
   num = strlen (str) / 3;
   if (strlen (str) % 3 > 0)
@@ -1068,3 +1068,50 @@
   exit (0);
 }
 
+
+GList *
+get_next_selection (GList * selection, GList ** list, int *curnum)
+{
+  gftp_file * tempfle;
+  int i, newpos;
+
+  newpos = GPOINTER_TO_INT (selection->data);
+  i = *curnum - newpos;
+
+  if (i < 0)
+    {
+      while (i != 0)
+        {
+          tempfle = (*list)->data;
+          if (tempfle->shown)
+            {
+	      ++*curnum;
+	      i++;
+            }
+	  *list = (*list)->next;
+        }     
+    }
+  else if (i > 0)
+    {
+      while (i != 0)
+        {
+          tempfle = (*list)->data;
+          if (tempfle->shown)
+            {
+	      --*curnum;
+	      i--;
+            }
+	  *list = (*list)->prev;
+        }
+    }
+
+  tempfle = (*list)->data;
+  while ((*list)->next && !tempfle->shown)
+    {
+      *list = (*list)->next;
+      tempfle = (*list)->data;
+    }
+  return (selection->next);
+}
+
+
--- a/lib/protocols.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/lib/protocols.c	Wed Jul 02 01:44:57 2003 +0000
@@ -339,7 +339,7 @@
 
 #if GLIB_MAJOR_VERSION > 1
 static char *
-_gftp_get_next_charset (char *remote_charsets, char **curpos)
+_gftp_get_next_charset (char *remote_charsets, char *orig_str, char **curpos)
 {
   char *ret, *endpos;
 
@@ -348,24 +348,39 @@
 
   ret = *curpos;
   if (*curpos != remote_charsets)
-    *(*curpos - 1) = ',';
+    {
+      *orig_str = *(*curpos - 1);
+      *(*curpos - 1) = ',';
+    }
 
   if ((endpos = strchr (*curpos, ',')) == NULL)
     *curpos += strlen (*curpos);
   else
     {
       *endpos = '\0';
-      *curpos = endpos + 1;
+
+      if (*orig_str != '\0')
+        *curpos = endpos + 1;
+      else
+        *curpos = endpos;
     }
 
   return (ret);
 }
 
 
+static void
+_gftp_restore_charset_string (char **remote_charsets, char orig_str, char **curpos)
+{
+  if (*curpos != *remote_charsets)
+    *(*curpos - 1) = orig_str;
+}
+
+
 char *
 gftp_string_to_utf8 (gftp_request * request, char *str)
 {
-  char *ret, *remote_charsets, *stpos, *cur_charset;
+  char *ret, *remote_charsets, *stpos, *cur_charset, orig_str;
   gsize bread, bwrite;
   GError * error;
 
@@ -388,7 +403,7 @@
 
   ret = NULL;
   stpos = remote_charsets;
-  while ((cur_charset = _gftp_get_next_charset (remote_charsets, 
+  while ((cur_charset = _gftp_get_next_charset (remote_charsets, &orig_str,
                                                 &stpos)) != NULL)
     {
       if ((request->iconv = g_iconv_open ("UTF-8", cur_charset)) == (GIConv) -1)
@@ -405,10 +420,9 @@
       else
         {
           request->iconv_initialized = 1;
+          _gftp_restore_charset_string (&remote_charsets, *cur_charset, &stpos);
           break;
         }
-
-      /* FIXME 2.0.15 - fix NUL character in remote_charsets */
     }
 
   return (ret);
--- a/lib/rfc2068.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/lib/rfc2068.c	Wed Jul 02 01:44:57 2003 +0000
@@ -51,7 +51,7 @@
 rfc2068_read_response (gftp_request * request)
 {
   rfc2068_params * params;
-  char tempstr[512];
+  char tempstr[8192];
   int ret, chunked;
 
   params = request->protocol_data;
@@ -60,12 +60,19 @@
   params->rbuf = NULL;
   *tempstr = '\0';
   params->content_length = 0;
+
   if (request->last_ftp_response)
     {
       g_free (request->last_ftp_response); 
       request->last_ftp_response = NULL;
     }
 
+  if (params->extra_read_buffer != NULL)
+    {
+      g_free (params->extra_read_buffer);
+      params->extra_read_buffer = NULL;
+    }
+
   do
     {
       if ((ret = gftp_get_line (request, &params->rbuf, tempstr, 
@@ -97,7 +104,7 @@
       if (sscanf ((char *) tempstr, "%lx", &params->chunk_size) != 1)
         {
           request->logging_function (gftp_logging_recv, request,
-                                     _("Received wrong response from server, disconnecting\n"));
+                                     _("Received wrong response from server, disconnecting.\nExpecting a chunk size in the response from the remote server\n"));
           gftp_disconnect (request);
           return (GFTP_EFATAL);
         }
@@ -106,14 +113,18 @@
         return (0);
 
       params->chunk_size -= params->rbuf->cur_bufsize;
-
       if (params->chunk_size < 0)
         {
-          request->logging_function (gftp_logging_recv, request, "FIXME 2.0.15 - the chunk size is negative. aborting directory listing\n");
-          return (GFTP_EFATAL);
+          params->extra_read_buffer_len = params->chunk_size * -1;
+          params->extra_read_buffer = g_malloc (params->extra_read_buffer_len + 1);
+          memcpy (params->extra_read_buffer, params->rbuf->curpos + (params->rbuf->cur_bufsize - params->extra_read_buffer_len), params->extra_read_buffer_len);
+          params->extra_read_buffer[params->extra_read_buffer_len] = '\0';
+          params->rbuf->cur_bufsize -= params->extra_read_buffer_len;
+          params->chunk_size = 0;
         }
 
-        
+
+        params->chunk_size = 0;
     }
 
   params->chunked_transfer = chunked;
@@ -362,19 +373,13 @@
   if (request->datafd < 0)
     return (GFTP_EFATAL);
 
-  if (close (request->datafd) < 0)
-    request->logging_function (gftp_logging_error, request,
-                               _("Error closing file descriptor: %s\n"),
-                               g_strerror (errno));
-  request->datafd = -1;
+  gftp_disconnect (request);
 
   params = request->protocol_data;
   params->content_length = 0;
   params->chunked_transfer = 0;
   params->chunk_size = 0;
 
-  request->logging_function (gftp_logging_misc, request,
-                             _("Finished retrieving data\n"));
   return (0);
 }
 
@@ -425,6 +430,8 @@
       return (0);
     }
 
+  gftp_end_transfer (request);
+
   return (GFTP_ERETRYABLE);
 }
 
@@ -470,7 +477,7 @@
 static int
 parse_html_line (char *tempstr, gftp_file * fle)
 {
-  char *stpos, *pos;
+  char *stpos, *kpos, *mpos, *pos;
   long units;
 
   memset (fle, 0, sizeof (*fle));
@@ -559,15 +566,22 @@
     pos++;
 
   /* Get the size */
-  /* This gets confusing on lines like "... 1.1M RedHat RPM package" */
-  /* We need to avoid finding the 'k' in package */
- 
-  stpos = strchr (pos, 'k');
-  if (stpos == NULL || !isdigit (*(stpos - 1)))
-     stpos = strchr (pos, 'M');
+
+  kpos = strchr (pos, 'k');
+  mpos = strchr (pos, 'M');
+  if (kpos == NULL)
+    stpos = mpos;
+  else if (mpos == NULL)
+    stpos = kpos;
+  else if (kpos < stpos)
+    stpos = kpos;
+  else
+    stpos = mpos;
+
   if (stpos == NULL || !isdigit (*(stpos - 1)))
      return (1);			/* Return successfully
 					   since we got the file */
+
   if (*stpos == 'k')
     units = 1024;
   else
@@ -578,10 +592,9 @@
   while (*(stpos - 1) != ' ' && *(stpos - 1) != '\t' && stpos > tempstr) 
     {
       stpos--;
-      if ((*stpos == '.') && isdigit (*(stpos + 1)) ) 
+      if ((*stpos == '.') && isdigit (*(stpos + 1))) 
         {  /* found decimal point */
-          fle->size = units * strtol (stpos + 1, NULL, 10);
-          fle->size /= 10; /* FIXME */
+          fle->size = units * strtol (stpos + 1, NULL, 10) / 10;;
         }
     }
 
@@ -679,11 +692,24 @@
 static void
 rfc2068_destroy (gftp_request * request)
 {
+  rfc2068_params * params;
+
+  params = request->protocol_data;
+
   if (request->url_prefix)
     {
       g_free (request->url_prefix);
       request->url_prefix = NULL;
     }
+
+  if (params->rbuf != NULL)
+    gftp_free_getline_buffer (&params->rbuf);
+
+  if (params->extra_read_buffer != NULL)
+    {
+      g_free (params->extra_read_buffer);
+      params->extra_read_buffer = NULL;
+    }
 }
 
 
@@ -697,20 +723,30 @@
 
   params = request->protocol_data;
 
-  read_size = size;
-  if (params->content_length > 0)
+  /* FIXME - left off here */
+  if (params->extra_read_buffer != NULL)
     {
-      if (params->content_length == params->read_bytes)
-        return (0);
+      read_size = params->extra_read_buffer_len > size ? size : params->extra_read_buffer_len;
+      memcpy (ptr, params->extra_read_buffer, read_size);
+      retval = read_size;
+    }
+  else
+    {
+      read_size = size;
+      if (params->content_length > 0)
+        {
+          if (params->content_length == params->read_bytes)
+            return (0);
 
-      if (read_size + params->read_bytes > params->content_length)
-        read_size = params->content_length - params->read_bytes;
+          if (read_size + params->read_bytes > params->content_length)
+            read_size = params->content_length - params->read_bytes;
+        }
+      else if (params->chunked_transfer && params->chunk_size > 0 &&
+               params->chunk_size < read_size)
+        read_size = params->chunk_size;
+
+      retval = params->real_read_function (request, ptr, read_size, fd);
     }
-  else if (params->chunked_transfer && params->chunk_size > 0 &&
-           params->chunk_size < read_size)
-    read_size = params->chunk_size;
-
-  retval = params->real_read_function (request, ptr, read_size, fd);
 
   if (retval > 0)
     params->read_bytes += retval;
@@ -727,16 +763,22 @@
           if (*stpos != '\r' || *(stpos + 1) != '\n')
             {
               request->logging_function (gftp_logging_recv, request,
-                                         _("Received wrong response from server, disconnecting\n"));
+                                         _("Received wrong response from server, disconnecting\nExpecting a carriage return and line feed before the chunk size in the server response\n"));
               gftp_disconnect (request);
               return (GFTP_EFATAL);
             }
 
           for (endpos = stpos + 2; 
-               *endpos != '\n'; 
+               *endpos != '\n' && endpos < stpos + retval;
                endpos++);
-    
-          /* FIXME 2.0.15 extra checks */
+
+          if (*endpos != '\n')
+            {
+              request->logging_function (gftp_logging_recv, request,
+                                         "FIXME 2.0.15 - disconnecting, chunk size is in next packet\n");
+              gftp_disconnect (request);
+              return (GFTP_EFATAL);
+            }
 
           *endpos = '\0';
           if (*(endpos - 1) == '\r')
@@ -745,7 +787,8 @@
           if (sscanf (stpos + 2, "%lx", &params->chunk_size) != 1)
             {
               request->logging_function (gftp_logging_recv, request,
-                                         _("Received wrong response from server, disconnecting\n"));
+                                         _("Received wrong response from server, disconnecting\nInvalid chunk size '%s' returned by the remote server\n"), 
+                                         params->chunk_size);
               gftp_disconnect (request);
               return (GFTP_EFATAL);
             }
--- a/src/gtk/bookmarks.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/src/gtk/bookmarks.c	Wed Jul 02 01:44:57 2003 +0000
@@ -183,7 +183,6 @@
                  * tentry;
 
   new_bm = g_malloc0 (sizeof (*new_bm));
-  /* FIXME - memory leak */
   new_bm->path = g_malloc0 (1);
   new_bm->isfolder = bookmarks->isfolder;
   preventry = new_bm;
@@ -1196,7 +1195,6 @@
       gdk_window_set_icon_name (dialog->window, gftp_version);
     }
 
-  /* FIXME - memory leak */
   ifactory = item_factory_new (GTK_TYPE_MENU_BAR, "<bookmarks>", NULL, NULL);
   create_item_factory (ifactory, 7, menu_items, NULL);
   create_item_factory (ifactory, 1, menu_items + 7, dialog);
@@ -1214,7 +1212,6 @@
   gtk_container_border_width (GTK_CONTAINER (scroll), 3);
   gtk_widget_show (scroll);
 
-  /* FIXME - memory leak */
   edit_factory = item_factory_new (GTK_TYPE_MENU, "<edit_bookmark>", NULL, "/File");
 
   create_item_factory (edit_factory, 6, menu_items + 2, dialog);
--- a/src/gtk/gftp-gtk.h	Sat Jun 28 13:52:44 2003 +0000
+++ b/src/gtk/gftp-gtk.h	Wed Jul 02 01:44:57 2003 +0000
@@ -315,10 +315,6 @@
 						  GtkItemFactoryEntry * entries,
 						  gpointer callback_data );
 
-GList * get_next_selection 			( GList * selection, 
-						  GList ** list, 
-						  int *curnum );
-
 void add_history 				( GtkWidget * widget, 
 						  GList ** history, 
 						  unsigned int *histlen, 
--- a/src/gtk/misc-gtk.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/src/gtk/misc-gtk.c	Wed Jul 02 01:44:57 2003 +0000
@@ -585,52 +585,6 @@
     }
 }
 
-GList *
-get_next_selection (GList * selection, GList ** list, int *curnum)
-{
-  gftp_file * tempfle;
-  int i, newpos;
-
-  newpos = GPOINTER_TO_INT (selection->data);
-  i = *curnum - newpos;
-
-  if (i < 0)
-    {
-      while (i != 0)
-        {
-          tempfle = (*list)->data;
-          if (tempfle->shown)
-            {
-	      ++*curnum;
-	      i++;
-            }
-	  *list = (*list)->next;
-        }     
-    }
-  else if (i > 0)
-    {
-      while (i != 0)
-        {
-          tempfle = (*list)->data;
-          if (tempfle->shown)
-            {
-	      --*curnum;
-	      i--;
-            }
-	  *list = (*list)->prev;
-        }
-    }
-
-  tempfle = (*list)->data;
-  while ((*list)->next && !tempfle->shown)
-    {
-      *list = (*list)->next;
-      tempfle = (*list)->data;
-    }
-  return (selection->next);
-}
-
-
 void
 add_history (GtkWidget * widget, GList ** history, unsigned int *histlen, 
              const char *str)
--- a/src/gtk/transfer.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/src/gtk/transfer.c	Wed Jul 02 01:44:57 2003 +0000
@@ -1394,7 +1394,7 @@
 gint
 update_downloads (gpointer data)
 {
-  int do_one_transfer_at_a_time, start_file_transfers;
+  int do_one_transfer_at_a_time;
   GList * templist, * next;
   gftp_transfer * tdata;
 
@@ -1433,9 +1433,8 @@
 	    {
               gftp_lookup_global_option ("one_transfer", 
                                          &do_one_transfer_at_a_time);
-              start_file_transfers = 1; /* FIXME */
 
-	      if (!tdata->started && start_file_transfers &&
+	      if (!tdata->started && 
                  (num_transfers_in_progress == 0 || !do_one_transfer_at_a_time))
                 create_transfer (tdata);
 
--- a/src/text/gftp-text.c	Sat Jun 28 13:52:44 2003 +0000
+++ b/src/text/gftp-text.c	Wed Jul 02 01:44:57 2003 +0000
@@ -626,7 +626,10 @@
   g_free (fle);
 
   if (files == NULL)
-    return (1);
+    {
+      gftp_end_transfer (request);
+      return (1);
+    }
 
   if (request == gftp_text_locreq)
     {
@@ -668,6 +671,7 @@
 
       delitem = templist;
     }
+
   gftp_end_transfer (request);
 
   if (delitem != NULL)