diff -Npru dillo/src/IO/IO.c dillo.my/src/IO/IO.c
--- dillo/src/IO/IO.c	Mon Jan 28 14:31:12 2002
+++ dillo.my/src/IO/IO.c	Mon Feb 18 00:13:43 2002
@@ -25,6 +25,7 @@
 #include "../chain.h"
 #include "../klist.h"
 #include "IO.h"
+#include "giodillo.h"
 
 //#define DEBUG_LEVEL 3
 #include "../debug.h"
@@ -51,7 +52,7 @@ static Klist_t *ValidIOs = NULL; /* Acti
 IOData_t *a_IO_new(gint fd)
 {
    IOData_t *io = g_new0(IOData_t, 1);
-   io->GioCh = g_io_channel_unix_new(fd);
+   io->GioCh = g_io_channel_dillo_new(fd);
    io->FD = fd;
    io->Flags = 0;
    io->Key = 0;
diff -Npru dillo/src/IO/Makefile.am dillo.my/src/IO/Makefile.am
--- dillo/src/IO/Makefile.am	Mon Mar  5 21:11:39 2001
+++ dillo.my/src/IO/Makefile.am	Mon Feb 18 00:13:43 2002
@@ -10,4 +10,6 @@ libDio_a_SOURCES = \
 	file.c \
 	http.c \
 	IO.c \
-	IO.h
+	IO.h \
+	giodillo.c \
+	giodillo.h
diff -Npru dillo/src/IO/giodillo.c dillo.my/src/IO/giodillo.c
--- dillo/src/IO/giodillo.c	Wed Dec 31 21:00:00 1969
+++ dillo.my/src/IO/giodillo.c	Mon Feb 18 12:20:22 2002
@@ -0,0 +1,340 @@
+/* 
+ * File: giodillo.c: IO Channels for Dillo
+ *       Original giounix.c from glib-1.2.10
+ *
+ * Copyright (C) 2001 Livio Baldini Soares <livio@ime.usp.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <glib.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "../klist.h"
+
+/*
+ * Dillo IO Channels
+ */
+
+typedef struct _GIODilloChannel GIODilloChannel;
+typedef struct _GIODilloWatch GIODilloWatch;
+typedef struct _GIODilloHashEntry GIODilloHashEntry;
+
+/* 
+ * Local Data
+ */
+static GIODilloHashEntry *Polls = NULL;
+
+struct _GIODilloChannel {
+   GIOChannel channel;
+   gint fd;
+};
+
+struct _GIODilloWatch {
+   GPollFD       pollfd;
+   GIOChannel   *channel;
+   GIOCondition  condition;
+   GIOFunc       callback;
+};
+
+struct _GIODilloHashEntry {
+   GPollFD       *pollfd;
+   GSList        *watches;
+};
+
+
+static GIOError g_io_dillo_read (GIOChannel *channel, 
+				 gchar     *buf, 
+				 guint      count,
+				 guint     *bytes_written);
+		       
+static GIOError g_io_dillo_write(GIOChannel *channel, 
+				 gchar     *buf, 
+				 guint      count,
+				 guint     *bytes_written);
+static GIOError g_io_dillo_seek (GIOChannel *channel,
+				 gint      offset, 
+				 GSeekType type);
+static void g_io_dillo_close    (GIOChannel *channel);
+static void g_io_dillo_free     (GIOChannel *channel);
+static guint  g_io_dillo_add_watch (GIOChannel      *channel,
+				    gint           priority,
+				    GIOCondition   condition,
+				    GIOFunc        func,
+				    gpointer       user_data,
+				    GDestroyNotify notify);
+static gboolean g_io_dillo_prepare  (gpointer source_data, 
+				     GTimeVal *current_time,
+				     gint *timeout,
+				     gpointer user_data);
+static gboolean g_io_dillo_check    (gpointer source_data,
+				     GTimeVal *current_time,
+				     gpointer user_data);
+static gboolean g_io_dillo_dispatch (gpointer source_data,
+				     GTimeVal *current_time,
+				     gpointer user_data);
+static void g_io_dillo_destroy  (gpointer source_data);
+
+GSourceFuncs dillo_watch_funcs = {
+   g_io_dillo_prepare,
+   g_io_dillo_check,
+   g_io_dillo_dispatch,
+   g_io_dillo_destroy
+};
+
+GIOFuncs dillo_channel_funcs = {
+   g_io_dillo_read,
+   g_io_dillo_write,
+   g_io_dillo_seek,
+   g_io_dillo_close,
+   g_io_dillo_add_watch,
+   g_io_dillo_free,
+};
+
+static gboolean 
+g_io_dillo_prepare  (gpointer source_data, 
+		     GTimeVal *current_time,
+		     gint     *timeout,
+		     gpointer user_data)
+{
+   *timeout = -1;
+   return FALSE;
+}
+
+static gboolean 
+g_io_dillo_check    (gpointer source_data,
+		     GTimeVal *current_time,
+		     gpointer user_data)
+{
+   GIODilloWatch *data = source_data;
+
+   return (Polls[data->pollfd.fd].pollfd->revents & data->condition);
+}
+
+static gboolean
+g_io_dillo_dispatch (gpointer source_data, 
+		     GTimeVal *current_time,
+		     gpointer user_data)
+
+{
+   GIODilloWatch *data = source_data;
+
+   return (*data->callback)(data->channel,
+			    Polls[data->pollfd.fd].pollfd->revents & 
+			    data->condition,
+			    user_data);
+}
+
+static void 
+g_io_dillo_destroy (gpointer source_data)
+{
+   GIODilloWatch *data = source_data;
+
+   Polls[data->pollfd.fd].watches = 
+      g_slist_remove(Polls[data->pollfd.fd].watches, source_data);
+
+   if (g_slist_length(Polls[data->pollfd.fd].watches) > 0) {
+      GSList *l;
+
+      g_main_remove_poll (Polls[data->pollfd.fd].pollfd);
+      Polls[data->pollfd.fd].pollfd->events = 0;
+      for (l = Polls[data->pollfd.fd].watches; l; l = g_slist_next(l))
+	 Polls[data->pollfd.fd].pollfd->events |= ((GIODilloWatch *)l->data)->condition;
+      g_main_add_poll (Polls[data->pollfd.fd].pollfd, G_PRIORITY_DEFAULT);
+   }
+   else{
+      Polls[data->pollfd.fd].watches = NULL;
+      g_main_remove_poll (Polls[data->pollfd.fd].pollfd);
+      g_io_channel_unref (data->channel);
+      g_free (Polls[data->pollfd.fd].pollfd);
+      g_free (data);
+   }
+}
+
+static GIOError 
+g_io_dillo_read (GIOChannel *channel, 
+		 gchar     *buf, 
+		 guint      count,
+		 guint     *bytes_read)
+{
+   GIODilloChannel *dillo_channel = (GIODilloChannel *)channel;
+   gint result;
+
+   result = read (dillo_channel->fd, buf, count);
+
+   if (result < 0)
+      {
+	 *bytes_read = 0;
+	 switch (errno)
+	    {
+	    case EINVAL:
+	       return G_IO_ERROR_INVAL;
+	    case EAGAIN:
+	       return G_IO_ERROR_AGAIN;
+	    default:
+	       return G_IO_ERROR_UNKNOWN;
+	    }
+      }
+   else
+      {
+	 *bytes_read = result;
+	 return G_IO_ERROR_NONE;
+      }
+}
+		       
+static GIOError 
+g_io_dillo_write(GIOChannel *channel, 
+		 gchar     *buf, 
+		 guint      count,
+		 guint     *bytes_written)
+{
+   GIODilloChannel *dillo_channel = (GIODilloChannel *)channel;
+   gint result;
+
+   result = write (dillo_channel->fd, buf, count);
+
+   if (result < 0)
+      {
+	 *bytes_written = 0;
+	 switch (errno)
+	    {
+	    case EINVAL:
+	       return G_IO_ERROR_INVAL;
+	    case EAGAIN:
+	       return G_IO_ERROR_AGAIN;
+	    default:
+	       return G_IO_ERROR_UNKNOWN;
+	    }
+      }
+   else
+      {
+	 *bytes_written = result;
+	 return G_IO_ERROR_NONE;
+      }
+}
+
+static GIOError 
+g_io_dillo_seek (GIOChannel *channel,
+		 gint      offset, 
+		 GSeekType type)
+{
+   GIODilloChannel *dillo_channel = (GIODilloChannel *)channel;
+   int whence;
+   off_t result;
+
+   switch (type)
+      {
+      case G_SEEK_SET:
+	 whence = SEEK_SET;
+	 break;
+      case G_SEEK_CUR:
+	 whence = SEEK_CUR;
+	 break;
+      case G_SEEK_END:
+	 whence = SEEK_END;
+	 break;
+      default:
+	 g_warning ("g_io_dillo_seek: unknown seek type");
+	 return G_IO_ERROR_UNKNOWN;
+      }
+
+   result = lseek (dillo_channel->fd, offset, whence);
+
+   if (result < 0)
+      {
+	 switch (errno)
+	    {
+	    case EINVAL:
+	       return G_IO_ERROR_INVAL;
+	    default:
+	       return G_IO_ERROR_UNKNOWN;
+	    }
+      }
+   else
+      return G_IO_ERROR_NONE;
+}
+
+
+static void 
+g_io_dillo_close (GIOChannel *channel)
+{
+   GIODilloChannel *dillo_channel = (GIODilloChannel *)channel;
+
+   close (dillo_channel->fd);
+}
+
+static void 
+g_io_dillo_free (GIOChannel *channel)
+{
+   GIODilloChannel *dillo_channel = (GIODilloChannel *)channel;
+
+   g_free (dillo_channel);
+}
+
+static guint 
+g_io_dillo_add_watch (GIOChannel    *channel,
+		      gint           priority,
+		      GIOCondition   condition,
+		      GIOFunc        func,
+		      gpointer       user_data,
+		      GDestroyNotify notify)
+{
+   GIODilloWatch *watch = g_new (GIODilloWatch, 1);
+   GIODilloChannel *dillo_channel = (GIODilloChannel *)channel;
+
+   watch->channel = channel;
+   g_io_channel_ref (channel);
+   
+   watch->callback = func;
+   watch->condition = condition;
+   
+   watch->pollfd.fd = dillo_channel->fd;
+   watch->pollfd.events = condition;
+   
+   if (g_slist_length(Polls[dillo_channel->fd].watches) == 0) {
+      Polls[dillo_channel->fd].pollfd = g_new(GPollFD, 1);
+      Polls[dillo_channel->fd].pollfd->fd = dillo_channel->fd;
+      Polls[dillo_channel->fd].pollfd->events = condition;
+      g_main_add_poll (Polls[dillo_channel->fd].pollfd, priority);
+   }
+   else { 
+      g_main_remove_poll (Polls[dillo_channel->fd].pollfd);
+      Polls[dillo_channel->fd].pollfd->events |= condition;
+      g_main_add_poll (Polls[dillo_channel->fd].pollfd, priority);
+   }
+   
+   Polls[dillo_channel->fd].watches = 
+      g_slist_append(Polls[dillo_channel->fd].watches, watch);
+
+   return g_source_add (priority, TRUE, &dillo_watch_funcs, 
+			watch, user_data, notify);
+}
+
+GIOChannel *
+g_io_channel_dillo_new (gint fd)
+{
+   GIODilloChannel *dillo_channel = g_new (GIODilloChannel, 1);
+   GIOChannel *channel = (GIOChannel *)dillo_channel;
+
+   g_io_channel_init (channel);
+   channel->funcs = &dillo_channel_funcs;
+
+   dillo_channel->fd = fd;
+
+   if (!Polls) 
+      Polls = g_malloc0(1024*sizeof(GIODilloHashEntry));
+
+   return channel;
+}
+
+gint
+g_io_channel_dillo_get_fd (GIOChannel *channel)
+{
+   GIODilloChannel *dillo_channel = (GIODilloChannel *)channel;
+   return dillo_channel->fd;
+}
diff -Npru dillo/src/IO/giodillo.h dillo.my/src/IO/giodillo.h
--- dillo/src/IO/giodillo.h	Wed Dec 31 21:00:00 1969
+++ dillo.my/src/IO/giodillo.h	Mon Feb 18 00:13:43 2002
@@ -0,0 +1,18 @@
+/* 
+ * File: giodillo.h: IO Channels for Dillo
+ *       Original giounix.c from glib-1.2.10
+ *
+ * Copyright (C) 2001 Livio Baldini Soares <livio@ime.usp.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <glib.h>
+
+GIOChannel *g_io_channel_dillo_new (gint fd);
+
+gint g_io_channel_dillo_get_fd (GIOChannel *channel);
+
diff -Npru dillo/src/IO/http.c dillo.my/src/IO/http.c
--- dillo/src/IO/http.c	Thu Jan 24 15:08:44 2002
+++ dillo.my/src/IO/http.c	Mon Feb 18 00:13:43 2002
@@ -32,6 +32,7 @@
 #include "../web.h"
 #include "../interface.h"
 #include "../prefs.h"
+#include "giodillo.h"
 
 
 /* Used to send a message to the bw's status bar */
@@ -239,7 +240,7 @@ static int Http_connect_socket(ChainLink
    name.sin_port = S->port ? htons(S->port) : htons(DILLO_URL_HTTP_PORT);
    name.sin_addr.s_addr = htonl(S->ip_addr);
 
-   S->GioCh = g_io_channel_unix_new(S->SockFD);
+   S->GioCh = g_io_channel_dillo_new(S->SockFD);
    g_io_add_watch(S->GioCh, G_IO_ERR | G_IO_HUP | G_IO_OUT,
                   Http_use_socket, Info->LocalKey);
    status = connect(S->SockFD, (struct sockaddr *)&name, sizeof(name));

