Apache: uncompressing 'on the fly'?

lydia lydia at HULmail.Harvard.EDU
Tue May 19 10:11:14 EDT 1998


Here's an answer from our sysadmin--maybe this is all you need?

 > Is there a way of having the Apache web server uncompress files 'on the
 > fly', i.e. of having a compressed file automatically de-compressed byt the
 > server when responding to the user's request for the document?

What you want to use is the AddHandler, AddType, and/or Action
directives. These basically associates particular file extensions (.Z,
.zip, .gz, etc) or MIME types with particular actions to be taken on
those files. So you might say

Action application/zip unzip

This makes all .zip files be passed through unzip. Presumably unzip
has to live in the standard cgi-bin.

Action application/x-tar tar.xf

This passes .tar files through a cgi-script called tar.xf. tar.xf would
look something like

#!/bin/csh
tar xf -

Note that you wouldn't want to do this with tar archives containing
more than one file. 

Or, to use your very own personal compression program, you might say

Action application/x-custom-compression /my-cgi-bin/mydecompress
AddType application/x-custom-compression myZ

Now all files with .myZ extenions will be decompressed by
/my-cgi-bin/mydecompress.

More details at 
http://www.apache.org/docs/mod/mod_actions.html
http://www.apache.org/docs/mod/mod_mime.html

 - Alex Aminoff
   Unix System Administratror
   Harvard University Library Office of Information Systems




More information about the Web4lib mailing list