--- /dev/null
+--- dillo-0.6.6/src/IO/file.c.old Wed Jul 3 11:15:13 2002
++++ dillo-0.6.6/src/IO/file.c Wed Jul 3 13:36:12 2002
+@@ -29,6 +29,7 @@
+ #include <stdio.h>
+ #include <signal.h>
+ #include <math.h> /* for rint */
++#include <zlib.h>
+
+ #include <errno.h> /* for errno */
+ #include "Url.h"
+@@ -61,10 +62,12 @@
+ char *Filename;
+ const char *ContentType;
+ glong FileSize;
++ gint ContentEncoding; /* 0 normal, 1 gzipped */
+
+ pthread_t th1; /* This transfer's thread id. */
+ } DilloFile;
+
++#define GZIP_ENCODING 1
+
+
+ /*
+@@ -90,18 +93,30 @@
+ gint fds[2], fd;
+ struct stat sb;
+ DilloFile *Dfile;
++ gint ContentEncoding = 0;
+
+- if ( (fd = open(filename, O_RDONLY)) < 0 || pipe(fds) )
++ if ( (fd = open(filename, O_RDONLY)) < 0 || pipe(fds) ) {
+ return NULL;
+-
++ }
++ if (strncmp(strrchr(filename, '.'), ".gz", 3) == 0)
++ ContentEncoding = GZIP_ENCODING;
++
+ Dfile = g_new(DilloFile, 1);
+ Dfile->FD_Read = fds[0];
+ Dfile->FD_Write = fds[1];
+ Dfile->FD = fd;
+ Dfile->Filename = g_strdup(filename);
+- Dfile->ContentType = File_content_type(filename);
+- Dfile->FileSize = fstat(fd, &sb) ? -1 : (glong) sb.st_size;
+-
++ if (ContentEncoding == GZIP_ENCODING) {
++ gchar *tmp_filename = g_strndup(filename, strlen(filename) - 3);
++ Dfile->ContentType = File_content_type(tmp_filename);
++ g_free(tmp_filename);
++ Dfile->FileSize = -1;
++ }
++ else {
++ Dfile->ContentType = File_content_type(filename);
++ Dfile->FileSize = fstat(fd, &sb) ? -1 : (glong) sb.st_size;
++ }
++ Dfile->ContentEncoding = ContentEncoding;
+ return Dfile;
+ }
+
+@@ -162,6 +177,7 @@
+ char buf[8192];
+ DilloFile *Dfile = data;
+ ssize_t nbytes;
++ gzFile gzdata;
+
+ /* Set this thread to detached state */
+ pthread_detach(Dfile->th1);
+@@ -179,13 +195,22 @@
+ strcpy(buf, "\n");
+ write(Dfile->FD_Write, buf, strlen(buf));
+
+-
+- /* Append raw file contents */
+- while ( (nbytes = read(Dfile->FD, buf, 8192)) != 0 ) {
+- write(Dfile->FD_Write, buf, nbytes);
++ /* decompress gzipped file */
++ if (Dfile->ContentEncoding == GZIP_ENCODING) {
++ gzdata = gzdopen(Dfile->FD, "r");
++ while ((nbytes = gzread(gzdata, buf, 8192)) != 0 ) {
++ write(Dfile->FD_Write, buf, nbytes);
++ }
++ gzclose(gzdata);
+ }
++ else {
++ /* Append raw file contents */
++ while ( (nbytes = read(Dfile->FD, buf, 8192)) != 0 ) {
++ write(Dfile->FD_Write, buf, nbytes);
++ }
+
+- close(Dfile->FD);
++ close(Dfile->FD);
++ }
+ close(Dfile->FD_Write);
+ File_dillofile_free(Dfile);
+ return NULL;
+@@ -270,7 +295,7 @@
+ static void File_get(ChainLink *Info, void *Data, void *ExtraData)
+ {
+ const gchar *path;
+- gchar *filename;
++ gchar *filename, *tmp_filename;
+ gint fd;
+ struct stat sb;
+ IOData_t *io;
+@@ -286,7 +311,15 @@
+ else
+ filename = a_Url_parse_hex_path(Url);
+
++stat_point:
+ if ( stat(filename, &sb) != 0 ) {
++ char *ext = strrchr(filename, '.');
++ if (ext && strcmp(ext, ".gz") != 0) {
++ tmp_filename = filename;
++ filename = g_strconcat(tmp_filename, ".gz", NULL);
++ g_free(tmp_filename);
++ goto stat_point;
++ }
+ /* stat failed, prepare a file-not-found error. */
+ fd = -2;
+ } else if (S_ISDIR(sb.st_mode)) {