[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dhelp/dwww: "document.htmlgz", Apache mod_rewrite, mod_actions



 I've made some minor modifications to `dwww' that allow you to gzip
 the html documentation, provided you run `Apache' with mod_rewrite
 and mod_actions.  What it does is have `dwww' return a redirect URL,
 rather than try to access the HTML on its own.

 The redirect sends the browser to http://localhost/doc/blahblah/ and
 in /usr/doc/blahblah, the html files are gzipped, and renamed to
 file.htmlgz.

 There is a "/usr/doc/.htaccess" file that looks like this:

Attachment: .htaccess
Description: Binary data

 And in `cgi-bin', I've got simple scripts that just print the
 "Content-type:" header and `zcat' or `bunzip2' the data to the net.
 The server has been configured, in "/etc/apache/srm.conf", with:

DirectoryIndex index.html index.htmlgz index.htmlbz2

AddEncoding x-compress Z
AddEncoding x-gzip gz
AddEncoding x-bzip2 bz2

AddType text/x-html-gzip htmlgz
AddHandler x-html-gzip htmlgz
Action x-html-gzip /cgi-bin/zcat-html

AddType text/x-plain-gzipped .gz
AddHandler x-plain-gzipped .gz
Action x-plain-gzipped /cgi-bin/zcat-plain

# ... or bzip2 them.
AddType text/x-html-bzip2 htmlbz2
AddHandler x-html-bzip2 htmlbz2
Action x-html-bzip2 /cgi-bin/bz2cat-html

AddType text/x-plain-bzip2ed .bz2
AddHandler x-plain-bzip2ed .bz2
Action x-plain-bzip2ed /cgi-bin/bz2cat-plain
 I've written a simple cron job that runs once a week and ensures that
 all of the newly installed .html files get gzipped and overwrite the
 old .htmlgz's from before the upgrade.  I'd like it if the package
 installation tools would do that if the option is set for that.

 The URL's inside the documents don't need to be adjusted, since the
 sendmailish mod_rewrite rules handle that.  I suppose that `boa'
 could implement a similar thing without too much bloat, and could
 perhaps perform the decompression itself.

 It could also be modified to send that data as is, with the right
 "Content-type:" and "Transfer-encoding:" for a gzip enabled browser
 to uncompress at the user's end...  and perhaps only do that when
 `HTTP_USER_AGENT' is not =~ m/Win95|WinNT|Macintosh/, but unzip at
 the server when the other end cannot simply upgrade to GNU.

 The `dwww' patch is viewable from my `cvsweb'... I'll tell you the
 URL, maybe, if you write, and you're a Linux developer.[1] I have
 mailed it to Jim Pick; I don't know if he's had time to do anything
 with it or not.


Footnotes: 
[1]  I don't want to publish it to the search engines... I live on a
     modem connection.


-- 
mailto:karlheg@bittersweet.inetarena.com (Karl M. Hegbloom)
http://www.inetarena.com/~karlheg
Portland, OR  USA
Debian GNU 1.3.1+hamm Linux 2.0.33 AMD K5 PR-133
Will work for food, books, computer parts, and ski trips.

Attachment: pgpFgldtHZKy_.pgp
Description: PGP signature


Reply to: