On Tuesday 15 April 2008 10:22, Brett Schwarz wrote: > I think this sounds ok. Might want to piggy back off of what Daniel posted > a while back on this: > > http://www.mail-archive.com/[email protected]/msg10630.html > > So, I guess what we can do, is at least start out with the route that Jeff > R. proposed, and create a library (filters) to handle compression, using > the new command to expose the Ns_ConnSetGzipFlag function. If problems > arise doing it this way, or if performance is not good, then we can look > into moving into the core? >
If you download, compile and install the modified nszlib module: http://rmadilo.com/files/nszlib/ You can do the dynamic file part right now. Just use a filter similar to this: # gzip filter proc: proc ::do_gzip { why } { ns_zlib setflag 1 return filter_ok } # register gzip filter: ns_register_filter preauth GET /* ::do_gzip This catches all requests which use ns_return. You don't need to modify the core for this part. This is just for testing, a better filter proc would help, for instance, copy config data, or use it to register selected url patterns (taken from a config file setting). This would work like ns_pools works to register threadpools. Now the static files. There are some issues here (but see 4!): 1. The ns_gzip API can compress a file, but it removes the original, Also, the code to do this is not exposed as a C function. So some minor fixup to this module would help. 2. The compress.c API only allows you to register a function to compress to a DString, so a similar API is needed to register a file compression function. 3. The file compression would be used in fastpath.c, but exactly how would need more thought. Files are mmapped, and you would probably have to do both the original file and the compressed file. 4. Before all the above code is done, it might help to just put in the code to detect if a compressed version of the file exists and use it. Then the simple existence of the compressed version of the file would allow it to be used, without the need to use gzip internally. > So, I guess we'll need a filter to handle the dynamic pages, and then a > separate filter to handle the static pages (similar to Daniels solution). I haven't read Daniels solution, the only use of a filter is to turn on the gzip flag. (Note that there is a different on/off flag in the config file) 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.
