diff -Naur links-withgz/configure.in links-0.96pre1/configure.in
--- links-withgz/configure.in   Mon Apr  9 01:24:46 2001
+++ links-0.96pre1/configure.in Wed Jun  6 19:16:30 2001
@@ -80,6 +80,10 @@
AC_CHECK_FUNC(herror, AC_DEFINE(HAVE_HERROR))
AC_CHECK_FUNC(cfmakeraw, AC_DEFINE(HAVE_CFMAKERAW))

+# GZIP patch
+AC_CHECK_LIB(z,gzread)
+###
+
AC_MSG_CHECKING([for OS/2 threads])
CFLAGS_X="$CFLAGS"
CFLAGS="$CFLAGS -Zmt"
diff -Naur links-withgz/file.c links-0.96pre1/file.c
--- links-withgz/file.c Mon Jan  1 00:26:52 2001
+++ links-0.96pre1/file.c       Wed Jun  6 19:14:33 2001
@@ -339,20 +339,94 @@
               close(h);
               setcstate(c, S_FILE_TYPE); abort_connection(c); return;
       } else {
-               mem_free(name);
-               /* + 1 is there because of bug in Linux. Read returns -EACCES when
-                  reading 0 bytes to invalid address */
-               if (!(file = mem_alloc(stt.st_size + 1))) {
+
+/* GZIP patch */
+#ifdef HAVE_LIBZ
+               if (!casecmp(name + (strlen(name) - 3), ".gz", 3)) {
+                       unsigned char *tmp;
+                       int pos, len, tlen;
+                       gzFile filegz;
+
+                       filegz = gzdopen (h, "rb");
+
+                       if (!filegz) {
+                               mem_free(name);
+                               close(h);
+                               setcstate(c, S_CANT_READ);
+                               abort_connection(c);
+                               return;
+                       }
+
+                       mem_free(name);
+                       file = mem_alloc(BUFSIZ);
+
+                       if (!file) {
+                               close(h);
+                               setcstate(c, S_OUT_OF_MEM);
+                               abort_connection(c);
+                               return;
+                       }
+
+                       pos  = 0;
+                       tlen = 0;
+                       while (1) {
+                               len = gzread(filegz, file + pos, BUFSIZ);
+
+                               if (len < 0) {
+                                       close(h);
+                                       setcstate(c, S_CANT_READ);
+                                       abort_connection(c);
+                                       mem_free(file);
+                                       return;
+                               }
+
+                               if (!len) break;
+
+                               tlen += len;
+                               pos  += BUFSIZ;
+                               tmp = mem_realloc(file, pos + BUFSIZ);
+
+                               if (!tmp) {
+                                       close(h);
+                                       setcstate(c, S_OUT_OF_MEM);
+                                       abort_connection(c);
+                                       mem_free(file);
+                                       return;
+                               }
+
+                               file = tmp;
+                       }
+
                       close(h);
-                       setcstate(c, S_OUT_OF_MEM); abort_connection(c); return;
-               }
-               if ((r = read(h, file, stt.st_size)) != stt.st_size) {
-                       mem_free(file); close(h);
-                       setcstate(c, r == -1 ? -errno : S_FILE_ERROR);
-                       abort_connection(c); return;
+                       fl = tlen;
+               } else {
+#endif /* end GZIP PATCH */
+
+                       mem_free(name);
+
+                       /* + 1 is there because of bug in Linux. Read
+                          returns -EACCES when reading 0 bytes to invalid
+                          address */
+
+                       if (!(file = mem_alloc(stt.st_size + 1))) {
+                               close(h);
+                               setcstate(c, S_OUT_OF_MEM);
+                               abort_connection(c);
+                               return;
+                       }
+
+                       if ((r = read(h, file, stt.st_size)) != stt.st_size) {
+                               mem_free(file); close(h);
+                               setcstate(c, r == -1 ? -errno : S_FILE_ERROR);
+                               abort_connection(c); return;
+                       }
+                       close(h);
+                       fl = stt.st_size;
+/* GZIP patch */
+#ifdef LIBZ
               }
-               close(h);
-               fl = stt.st_size;
+#endif /* end GZIP patch */
+
               head = stracpy("");
       }
       if (get_cache_entry(c->url, &e)) {
diff -Naur links-withgz/links.h links-0.96pre1/links.h
--- links-withgz/links.h        Sat Jun  2 02:25:12 2001
+++ links-0.96pre1/links.h      Wed Jun  6 19:15:02 2001
@@ -79,6 +79,11 @@
#include <openssl/ssl.h>
#endif

+/* GZIP patch */
+#ifdef HAVE_LIBZ
+#include <zlib.h>
+#endif /* end GZIP patch */
+
#include "os_depx.h"

#include "setup.h"
diff -Naur links-withgz/types.c links-0.96pre1/types.c
--- links-withgz/types.c        Mon Jan  1 00:26:52 2001
+++ links-0.96pre1/types.c      Wed Jun  6 19:15:45 2001
@@ -65,6 +65,16 @@
               if (*ct == '.') ext = ct + 1;
               else if (dir_sep(*ct)) ext = NULL;
       if (ext) while (ext[extl] && !dir_sep(ext[extl]) && !end_of_dir(ext[extl])) extl++;
+
+/* GZIP patch */
+#ifdef HAVE_LIBZ
+       if (extl == 2 && ! casecmp(ext, "gz", 2)) {
+           if (!casecmp(url + (strlen(url) - 7), ".htm", 4) ||
+               !casecmp(url + (strlen(url) - 8), ".html", 5))
+               return stracpy("text/html");
+       }
+#endif /* end GZIP patch */
+
       if ((extl == 3 && !casecmp(ext, "htm", 3)) ||
           (extl == 4 && !casecmp(ext, "html", 4))) return stracpy("text/html");
       foreach(e, extensions) if (is_in_list(e->ext, ext, extl)) return stracpy(e->ct);