Okay, I have played around with this a little. Here are some notes and 
questions.

This doesn't work on static files, which might be a good thing.

Static files are handled via fastpath.c, and it is very efficient. It returns 
a not modified response, or zero content, just headers if the file hasn't 
changed. When you combine this with the browser cache, even a refresh is 
efficient. So, with AOLserver, try to use static files if possible, even as a 
cache, which we have talked about before.

Dynamic files are covered, Filters can be used to enable the flag for a given 
conn, the filter pattern limits the scope. Local tcl files can disable 
compression.

So the question is how to handle static files. One idea is to check if 
compression is enabled, if so, check if a compressed file exists 
(file.ext.gz), use the uncompressed file to figure out the content type, and 
return the compressed file (assuming the client sends the correct headers).

Ideas?

tom jackson



On Monday 14 April 2008 13:39, Tom Jackson wrote:
> Brett,
>
> I think I got the gzip thing working, at least the flag part.
>
> It turns out that all the plumbing is already in AOLserver. The only thing
> missing was the ability to call Ns_ConnSetGzipFlag as a tcl command.
>
> The gzip/compress core code is in 'compress.c', but the gzip functions are
> in the zlib module. Since the zlib module has a tcl command, I added a
> subcommand to this to handle the switch.
>
> There is a little more to it, but basically here is the addition:
>
>     case ZSetFlagIdx:
>       if (Tcl_GetBooleanFromObj(interp, objv[2], &compress) != 0) {
>           return TCL_ERROR;
>       }
>       Ns_Log(Notice, "Setting Gzip Flag to %i", compress);
>       Ns_ConnSetGzipFlag( Ns_GetConn(), compress );
>       break;
>     }
>
> The modified code is here:
>
> http://rmadilo.com/files/nszlib/
>
>
> There are some notes on this for the existing adp compression:
>
> ns_section ns/server/server1
> ns_param gzip true;      # Enable compression.
> ns_param gziplevel 4;    # Compression level.
> ns_param gzipmin 4096;   # Minimum size before gzip.
>
> You use the API Like this:
>
> ns_zlib setflag 1 ;#(or 0) (any boolean value actually)
>
>
> tom jackson
>
>
> --
> AOLserver - http://www.aolserver.com/
>
> To Remove yourself from this list, simply send an email to
> <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the
> email message. You can leave the Subject: field of your email blank.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to