RE: [Compress HTML output]
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Not sure if this has been talked about in detail but with the interest in dynamic html compression I will throw my two cents in. And donations of this sort are *always* appreciated! Thanks! ;-) Why use a cfx tag with coldfusion to compress html output when you can use IIS 5.0's builtin gzip/deflate compressors? We're stuck on WinNT4 for various reasons, so using IIS compression wasn't an option for us. Also, for non-IIS users, this CFX version should still do the trick even if their webserver doesn't support compression. I bet the cfx/cf overhead is much higher and not suitable for high volume situations. It's been running like a champ for us over the last three days on a moderately high volume site. I can't imagine that the CFX overhead would be that much higher than ISAPI overhead. CFX_GZip is a good multi-threaded tag... With IIS 4.0 you need the recource kit which contains the isapi compression filters. A Now this I did not know... I must give this a try... By default, you can set IIS to do a "application" level, not "static" level compression, which would compress dynamic content. Go to the "services" tab of the server in the mmc. However, and by default, the dynamic compression only applies ... Very interesting... I will most certainly try this. Thanks for the pointer! Best regards, Zac Bedell -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOkYVcKvhLS1aWPxeEQLBawCdFX8/Cx8ZLwFJk2h0u8vHZvxn2IIAoNXC /aYrqpaVDexfyCoWzqU8BwOP =9yi3 -END PGP SIGNATURE- ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
Could you please explain how this compression works. I keep seeing this as it is being compressed and decompressed at the server, or is it being compressed at the server and decompressed at the client. Bob Everland -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 24, 2000 10:26 AM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Not sure if this has been talked about in detail but with the interest in dynamic html compression I will throw my two cents in. And donations of this sort are *always* appreciated! Thanks! ;-) Why use a cfx tag with coldfusion to compress html output when you can use IIS 5.0's builtin gzip/deflate compressors? We're stuck on WinNT4 for various reasons, so using IIS compression wasn't an option for us. Also, for non-IIS users, this CFX version should still do the trick even if their webserver doesn't support compression. I bet the cfx/cf overhead is much higher and not suitable for high volume situations. It's been running like a champ for us over the last three days on a moderately high volume site. I can't imagine that the CFX overhead would be that much higher than ISAPI overhead. CFX_GZip is a good multi-threaded tag... With IIS 4.0 you need the recource kit which contains the isapi compression filters. A Now this I did not know... I must give this a try... By default, you can set IIS to do a "application" level, not "static" level compression, which would compress dynamic content. Go to the "services" tab of the server in the mmc. However, and by default, the dynamic compression only applies ... Very interesting... I will most certainly try this. Thanks for the pointer! Best regards, Zac Bedell -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOkYVcKvhLS1aWPxeEQLBawCdFX8/Cx8ZLwFJk2h0u8vHZvxn2IIAoNXC /aYrqpaVDexfyCoWzqU8BwOP =9yi3 -END PGP SIGNATURE- ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Could you please explain how this compression works. I keep seeing this as it is being compressed and decompressed at the server, or is it being compressed at the server and decompressed at the client. After CF is done creating all of the various HTML that will be sent out to clients, this tag grabs all the content and GZips it on the server side. The GZipped data is sent to the client where the client automatically GUnzips it and displays it to the user normally. The human at the browser shouldn't even know anything unusual has happened. As far as I know, all of the HTTP/1.1 browsers support gzip encoding. In any case, there's an Accept-Encoding header that browsers send if they're capable of compression. This tag checks to see if gzip is one of the supported compression types. If it is, the tag does its thing. If not, the HTML is sent uncompressed for clients that don't know how to decompress it. Using GZip level 9 compression, it's not unusual to see compression ratios of 5 to 10 times. Note that this does NOT work for any pages that use CFCONTENT with a file attribute. In those cases, the file from CFCONTENT is sent out without any compression, and this tag never even executes (since CF stops executing the page after the CFCONTENT tag is done). The web server based (as opposed to this CF Server based) solution is a little different, tho it accomplishes the same thing. I would imagine that in those cases, CFCONTENT results would also be compressed. I still haven't hand a chance to play with that, but it should be interesting. Best regards, Zac Bedell -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOkZBsKvhLS1aWPxeEQKlqgCg5QV9XWloUHiSxAgcdlnT0O4UY0YAoOqS ZB/d+E31i/1KPu2pSgt5gK85 =XB79 -END PGP SIGNATURE- ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
Ok I understand what has been done the only thing I see as a problem is that the tag is writing a file. Now without locking or without a unique name something bad is bound to happen. And once you put locking on the writing of files there is gonna be a slowdown. I don't see this as a good solution for large webservers with a lot of users. Maybe on an extranet where everything is semi controlled or on an intranet, but I don't think on a regular webserver this is a good idea. Bob Everland -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 24, 2000 10:26 AM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Not sure if this has been talked about in detail but with the interest in dynamic html compression I will throw my two cents in. And donations of this sort are *always* appreciated! Thanks! ;-) Why use a cfx tag with coldfusion to compress html output when you can use IIS 5.0's builtin gzip/deflate compressors? We're stuck on WinNT4 for various reasons, so using IIS compression wasn't an option for us. Also, for non-IIS users, this CFX version should still do the trick even if their webserver doesn't support compression. I bet the cfx/cf overhead is much higher and not suitable for high volume situations. It's been running like a champ for us over the last three days on a moderately high volume site. I can't imagine that the CFX overhead would be that much higher than ISAPI overhead. CFX_GZip is a good multi-threaded tag... With IIS 4.0 you need the recource kit which contains the isapi compression filters. A Now this I did not know... I must give this a try... By default, you can set IIS to do a "application" level, not "static" level compression, which would compress dynamic content. Go to the "services" tab of the server in the mmc. However, and by default, the dynamic compression only applies ... Very interesting... I will most certainly try this. Thanks for the pointer! Best regards, Zac Bedell -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOkYVcKvhLS1aWPxeEQLBawCdFX8/Cx8ZLwFJk2h0u8vHZvxn2IIAoNXC /aYrqpaVDexfyCoWzqU8BwOP =9yi3 -END PGP SIGNATURE- ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: [Compress HTML output]
It's been running like a champ for us over the last three days on a moderately high volume site. I can't imagine that the CFX overhead would be that much higher than ISAPI overhead. CFX_GZip is a good multi-threaded tag... The overhead is most likely on the cache file writes and cache reads. You just gave me an idea for a work around that could be better and faster than all the options we have just discussed. With both ISAPI and CFX, the system has to compress each and every single page output as it is a new one. Might as well store the compress data into the db using CFX_GZip and serve it out of the database. This way, not only do we save CPU time we also save I/O overhead. Serving from the database is much more efficient (ram and cpu wise) in the long run than reading from the filesystem. So we only compress it once every so minutes or hours. With IIS 4.0 you need the recource kit which contains the isapi compression filters. A Now this I did not know... I must give this a try... Look for compFilt.dll and gzlip.dll and deflate.dll Xing ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: [Compress HTML output]
It's compressed at the server and decompressed at the client. Pretty sure all current browsers support both the deflate(an compression algorithm not the expanding part) and gzip. The decompression is very fast so the end user doesn't even see a difference. Xing Could you please explain how this compression works. I keep seeing this as it is being compressed and decompressed at the server, or is it being compressed at the server and decompressed at the client. Bob Everland -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 24, 2000 10:26 AM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Not sure if this has been talked about in detail but with the interest in dynamic html compression I will throw my two cents in. And donations of this sort are *always* appreciated! Thanks! ;-) Why use a cfx tag with coldfusion to compress html output when you can use IIS 5.0's builtin gzip/deflate compressors? We're stuck on WinNT4 for various reasons, so using IIS compression wasn't an option for us. Also, for non-IIS users, this CFX version should still do the trick even if their webserver doesn't support compression. I bet the cfx/cf overhead is much higher and not suitable for high volume situations. It's been running like a champ for us over the last three days on a moderately high volume site. I can't imagine that the CFX overhead would be that much higher than ISAPI overhead. CFX_GZip is a good multi-threaded tag... With IIS 4.0 you need the recource kit which contains the isapi compression filters. A Now this I did not know... I must give this a try... By default, you can set IIS to do a "application" level, not "static" level compression, which would compress dynamic content. Go to the "services" tab of the server in the mmc. However, and by default, the dynamic compression only applies ... Very interesting... I will most certainly try this. Thanks for the pointer! Best regards, Zac Bedell -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOkYVcKvhLS1aWPxeEQLBawCdFX8/Cx8ZLwFJk2h0u8vHZvxn2IIAoNXC /aYrqpaVDexfyCoWzqU8BwOP =9yi3 -END PGP SIGNATURE- ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
Ok I understand what has been done the only thing I see as a problem is that the tag is writing a file. Now without locking or without a unique name something bad is bound to happen. And once you put locking on the writing of files there is gonna be a slowdown. The filename for the tempfiles is based on a call to CreateUUID(). If that's not giving you a unique filename, then you have much, MUCH bigger problems to worry about... There are two files created, and it looks a little something like this: !--- I don't have the actual code in front of me to cut paste from, but here's the basic gist... --- cfset TempPath = "c:\temp\compress\" cfset UUID = CreateUUID() cfset RawFile = "#TempPath##UUID#.htm" cfset GZipFile = "#TempPath##UUID#.gz" You can't get too much more unique than that. I don't see this as a good solution for large webservers with a lot of users. Maybe on an extranet where everything is semi controlled or on an intranet, but I don't think on a regular webserver this is a good idea. I've got an 800,000ish user session per month site running it quite nicely for the past three days (almost four days as I write this...). No hiccoughs, no user complaints. In fact... I don't even think the users have noticed anything other than the speed increase (we have had two or three comments on that). Granted... This isn't the type of thing you'd want to run on Microsoft.com, but if you have a moderate load site and enough extra processor to throw at it (we have both), then you can really save some bandwidth, if that's something you need to do. If you've got quad T3's coming out of your server, don't waste your time with this tag. But if bandwidth is getting a little tight lately, this *might* be something to at least give a try. It's easy enough to implement and easy enough to remove if it does cause problems. In our case, we have a sh'load of server to throw at this app, but bandwidth is a bit limited at this point in time. The compression is really helping. AND... The server based add-on that Xing Li mentioned looks even better. If we were running IIS 5, I would have installed that compression option in a heart beat. Now that I know IIS 4 has the same ability w/ a little added software from MS, I'm going to be implementing it next week. Best regards, Zac Bedell ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
The overhead is most likely on the cache file writes and cache reads. You just gave me an idea for a work around that could be better and faster than all the options we have just discussed. With both ISAPI and CFX, the system has to compress each and every single page output as it is a new one. Might as well store the compress data into the db using CFX_GZip and serve it out of the database. This way, not only do we save CPU time we also save I/O overhead. Serving from the database is much more efficient (ram and cpu wise) in the long run than reading from the filesystem. So we only compress it once every so minutes or hours. Hmmm... Very interesting... I was considering decrupting CFCACHE and using this bit of code in there. Using the DB instead... That has some promise... I may have a project to play with Why cache DB queries when you can cache the entire page result that was based on the query, right? My only concern is that CF seems to be very unfriendly to binary data. I wonder if there is any way that you could get the binary GZIP data back out of the DB and serve it to the browser without needing to save it to a temporary file and use CFCONTENT to send it out. If that does indeed pose a problem, then perhaps hacking up CFCACHE might be the only solution. With IIS 4.0 you need the recource kit which contains the isapi compression filters. A Now this I did not know... I must give this a try... Look for compFilt.dll and gzlip.dll and deflate.dll Will do. Thanks! Best regards, Zac Bedell ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Okay... I think the tag is done. I made a few more changes (see below). I also figured out how to automagically compress all the pages in your site w/ one little change. Here's what I did find: In the Application.cfm, I put this code: CF_GZipPage Cfinclude template="/RootMapping#CGI.Script_Name#" cfinclude template="OnRequestEnd.cfm" /CF_GZipPage cfabort Note that you could omit the OnRequestEnd line if you don't use that file OR you could put it into a try block if you're not sure they're'll be an OnRequestEnd like: cftrycfinclude template="OnRequestEnd.cfm"cfcatch type="MissingInclude"/cfcatch/cftry Also note that the above, if dropped at the end of your application.cfm would ignore any all output that was actually generated by your app.cfm. That's what I wanted in my case. If you're outputting stuff in your app.cfm that you need, then you should do something like: CF_GZipPage !--- All your app.cfm stuff here. --- Cfinclude template="/RootMapping#CGI.Script_Name#" cfinclude template="OnRequestEnd.cfm" /CF_GZipPage cfabort We get anywhere from 2 to 10 times compression, and our customers are already commenting on the speed increase. The system's processors are of course working a little harder now, but that means they're floating at 10% instead of at 4%. Whoopee! Here's the tag for people's perusal. If you find any glaring errors or have general suggestions, please share them with me. If I don't hear anything, I'll post this in the tag gallery some time next week. Best regards, Zac Bedell -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOkObpqvhLS1aWPxeEQJAcwCaAlXKaaZrAK4UDYzvMZ/pVaT/wTUAoOuF sdj1jvSQDab6aH6Q4TV9xQHZ =3LEC -END PGP SIGNATURE- GZipPage.cfm: (This will probably be looped by your mail reader/server.) =-=-=-=-=-=-= !--- CF_GZipPage -- Let's call this Version 1.0... Make sure this tag surrounds the ENTIRE page. It will GZIP the GeneratedContent using CFX_GZip and modify the browser headers so that the browser can decode it. Anything that falls outside of the start and end tag for this tag will be ignored and never seen by the client. Parameters (All are optional): Level: The GZip Compression Level, 0 is lowest compression (biggest size, least processor usage), 9 is highest compression (smallest size, greatest processor usage) Directory: The temporary directory to use for compression. Two files will be created here for each request. This directory must exist or the tag will error. CopyLeft 2000 Zachary Bedell [EMAIL PROTECTED] Special thanks to: Orlando Correa [EMAIL PROTECTED] for suggesting the Directory attribute and for code to check the Accept-Encoding header. Peter Stolz [EMAIL PROTECTED] for reminding me that the Accept-Encoding header exists... All the folks on CF-Talk who took the time to read these posts test out the tag. You may use this code as you wish, no strings attached. No Warrenty. If it breaks, you get to keep both pieces -ZSB 18-Dec-2000 --- cfif ThisTag.ExecutionMode EQ "END" !--- Sane defaults: --- cfparam name="Attributes.Level" default="9" cfparam name="Attributes.Directory" default="c:\temp" cfparam name="Attributes.ShowDebugging" default="false" cfif ListContainsNoCase(CGI.HTTP_Accept_Encoding, "gzip") AND Attributes.Level GT 0 AND Attributes.Level LTE 9 !--- If this browser can't handle GZIP encoding, then there's no point in doing anything... If the GZIP level is 0 that means no compression, so let's not waste our time. Also, if it's greater than 9, we'd have an error, so just get on with things... --- cfset Directory = Attributes.Directory cfif Right(Directory, 1) NEQ "\"cfset Directory = Directory "\"/cfif !--- Setup path filename for tempfiles: --- cfset UniqueFilePath = "#Directory##CreateUUID()#" cfset RawHTMLFile = "#UniqueFilePath#.htm" cfset GZippedFile = "#UniqueFilePath#.gz" !--- Grab the generated content and write it out to a tempfile. --- cfset Content = Trim(ThisTag.GeneratedContent) cfif Attributes.ShowDebugging cfset DebugText = "#Chr(13)##Chr(10)#!-- Page Compressed by CF_GZipPage. Original Size: #Len(Content)#--" Cfset Content = Content DebugText /cfif cffile action="WRITE"
Re: [Compress HTML output]
Not sure if this has been talked about in detail but with the interest in dynamic html compression I will throw my two cents in. Why use a cfx tag with coldfusion to compress html output when you can use IIS 5.0's builtin gzip/deflate compressors? I bet the cfx/cf overhead is much higher and not suitable for high volume situations. With IIS 4.0 you need the recource kit which contains the isapi compression filters. By default, you can set IIS to do a "application" level, not "static" level compression, which would compress dynamic content. Go to the "services" tab of the server in the mmc. However, and by default, the dynamic compression only applies to "asp", "exe", and "dll" extensions. So for it to compress cf streams than you need to use METAEDIT.EXE to modify the metadata which is like the registry but specific to IIS. There you can add "cfm" to the HcScriptFileExtension key under W3SVC/Filters/Compression/+ deflate/gzip. Once done, do a "c:\inetpub\adminscripts\IISreset.exe /restart" in the cmd window and you should see the "inetinfo" process take up much more cpu usage than before. If not then it is still not configured right. You can also use the METAEDIT.EXE to change the compressing buffer size, compression level, etc... I was able to reduce the bandwith usage from 3.3mb/s to 2mb/s which is close to 40% decause in bandwith using level 7 compression. Still not sure if IIS is using GZIP or DEFLATE but I'm happy nonetheless. Xing ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
I just stumbled across this thread and I must say that it had never occurred to me that you could zip html and have it unzipped at the client - should read a few more RFCs eh! Anyway, as excited as a small boy in a big room full of sweets I knocked up a quick tag. Everyone please feel free to use/ignore/modify/etc. !--- cf_gzip by Steve Martin 21/Dec/2000 Utilises cfx_gzip by Michael Peacock, New Media Designs, Inc., which is based upon public domain code. Usage: Enclose an entire page in cf_gzipyada yada/cf_gzip --- cfswitch expression="#ThisTag.Executionmode#" cfcase value="end" !--- Set a couple of defaults. --- !--- attributes.compress allows you to turn off compression for ebugging --- cfparam name="attributes.compress" default="1" !--- Compression level --- cfparam name="attributes.level" default="7" !--- Does the browser support gzip --- CFIF listcontainsnocase(cgi.http_accept_encoding,"gzip") and attributes.compress !--- Create a temp filename --- cfset tmpFile=ExpandPath(CreateUUID() ".tmp") !--- Write the generated content to the file --- cffile action="WRITE" file="#tmpFile#" output="#ThisTag.GeneratedContent#" addnewline="Yes" !--- Blank out the generated content --- cfset ThisTag.GeneratedContent="" !--- Zip the file (creates a new file with .gz appended)--- CFX_GZip LEVEL="#attributes.level#" action=GZip infile=#tmpFile# !--- Delete the original tempfile --- cffile action="DELETE" file="#tmpFile#" !--- Serve the gzipped file delete --- cfheader name="Content-Encoding" value="gzip" cfcontent type="text/html" file="#tmpFile#.gz" deletefile="Yes" /CFIF /cfcase /cfswitch ATB Steve Martin -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: 20 December 2000 17:55 To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks for the reminder on that one! I was going to do that... I even had RFC 2616 on my desk to look up how to do that, and I completely forgot... I've actually got some "real work" to do today (darn clients always interrupting my fun!), but once I get that taken care of, I'll integrate the various suggestions on this see if I can turn it into a real tag Thanks again to everyone for the tips pointers! Best regards, Zac Bedell ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
Just check the cgi.http_accept_encoding for the existance of "gzip" CFDEFAULTCASE CFIF listcontainsnocase(cgi.http_accept_encoding,"gzip")!--- AND NOT dev_server --- CF_GZipPage LEVEL="7" CFINCLUDE TEMPLATE="myheavypage.cfm" /CF_GZipPage CFELSE CFINCLUDE TEMPLATE="myheavypage.cfm" /CFIF /CFDEFAULTCASE -Original Message- From: Peter Stolz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 19, 2000 8:30 PM To: CF-Talk Subject: RE: [Compress HTML output] This is great! One question though: The servlet version checks for the ACCEPT_ENCODING request header before it does the actual encoding. I don't know of a way to do this in CF. Any ideas? P. -Original Message- From: Orlando Correa (ITSC) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 19, 2000 9:58 AM To: CF-Talk Subject: RE: [Compress HTML output] Hey Zach... After some testing... I implemented your code to test compression of a particularly large html file with some encouraging results... The uncompressed page was 165K and took 391 milliseconds to excute. The compressed page is 20K with an added server overhead of around 375K milliseconds... The savings in download time for the html, in this case, warrent further explortion of compressing certain "heavy" pages (87.8% compression on level 7). Thanks dude! Pretty slick. I've hacked on your code a bit to test it in our development enviornment... cfif ThisTag.ExecutionMode EQ "Start" cfset start_time=gettickcount() /cfif cfif ThisTag.ExecutionMode EQ "END" !--- Sane defaults: --- cfparam name="Attributes.Level" default="9" cfparam name="Attributes.Unique" default="#RandRange(1,1000)#" cfparam name="Attributes.Directory" default="c:\temp" !--- set temp dir --- cfset dir_compress = Attributes.Directory cfif not IsDefined("application.IsDir") !--- check if the directory exists --- cfdirectory name="qry_checkdir" directory="#dir_compress#" action="LIST" !--- if it doesn't exist, create new directory #dir_compress# --- cfif not qry_checkdir.recordcount cfdirectory action="CREATE" directory="#dir_compress#" /cfif !--- set IsDir flag for by-passing directory check --- cflock scope="application" timeout="10" cfset application.IsDir = 1 /cflock /cfif !--- Setup path filename for tempfiles: --- cfset RawHTMLFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Unique#_#RandRang e(1,100)#.out" cfset GZippedFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Unique#_#RandRang e(1,100)#.in" !--- Grab the generated content and write it out to a tempfile.--- cfset end_time=gettickcount() cfset time = end_time-start_time "Milliseconds" cfset Content = Trim(ThisTag.GeneratedContent) time cffile action="WRITE" file="#RawHTMLFile#" output="#Content#" !--- Compress the tempfile to another tempfile --- cfx_GZip action="GZIP" InFile="#RawHTMLFile#" OutFile="#GZippedFile#" level="#Attributes.Level#" cffile action="delete" file="#RawHTMLFile#" !--- Setup the headers and write the mess back out to the client w/CFCONTENT --- cfset ThisTag.GeneratedContent = "" cfheader name="Content-Encoding" value="gzip" cfcontent file="#GZippedFile#" deletefile="Yes" type="text/html" /cfif -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Monday, December 18, 2000 2:20 PM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 compression is a web server issue NOT CF. That's true, but it doesn't mean you can't do it in CF... Below is a custom tag that will do just that, provided you have CFX_GZip installed (freely downloadable from the tag gallery). I'm not sure whether the savings in bandwidth is worth the additional processor power (anyone wanna run tests?), but it's still nifty... One place this would really be a savings: If you already use CFCACHE, you should be able to modify the CFCache tag to also do compression before it saves a file. That way you only need to compress the file once, and you get the processor savings of CFCache AND the bandwidth savings of compression. I'll probably post this tag to the tag gallery once I beat on it for a little longer. In the meantime, enjoy... -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOj5/Z6vhLS1aWPxeEQKSRwCg+iRBf/fA8Y72IbopUMF0kM6NEkkAnj+k wwQDQrb5RkIfgaFn1TRaW8Ub =4/Jb -END PGP SIGNATURE- !--- CF_GZipPage
RE: [Compress HTML output]
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks for the reminder on that one! I was going to do that... I even had RFC 2616 on my desk to look up how to do that, and I completely forgot... I've actually got some "real work" to do today (darn clients always interrupting my fun!), but once I get that taken care of, I'll integrate the various suggestions on this see if I can turn it into a real tag Thanks again to everyone for the tips pointers! Best regards, Zac Bedell -Original Message- From: Orlando Correa (ITSC) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 20, 2000 5:55 AM To: CF-Talk Subject: RE: [Compress HTML output] Just check the cgi.http_accept_encoding for the existance of "gzip" CFDEFAULTCASE CFIF listcontainsnocase(cgi.http_accept_encoding,"gzip")!--- AND NOT dev_server --- CF_GZipPage LEVEL="7" CFINCLUDE TEMPLATE="myheavypage.cfm" /CF_GZipPage CFELSE CFINCLUDE TEMPLATE="myheavypage.cfm" /CFIF /CFDEFAULTCASE -Original Message- From: Peter Stolz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 19, 2000 8:30 PM To: CF-Talk Subject: RE: [Compress HTML output] This is great! One question though: The servlet version checks for the ACCEPT_ENCODING request header before it does the actual encoding. I don't know of a way to do this in CF. Any ideas? P. -Original Message- From: Orlando Correa (ITSC) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 19, 2000 9:58 AM To: CF-Talk Subject: RE: [Compress HTML output] Hey Zach... After some testing... I implemented your code to test compression of a particularly large html file with some encouraging results... The uncompressed page was 165K and took 391 milliseconds to excute. The compressed page is 20K with an added server overhead of around 375K milliseconds... The savings in download time for the html, in this case, warrent further explortion of compressing certain "heavy" pages (87.8% compression on level 7). Thanks dude! Pretty slick. I've hacked on your code a bit to test it in our development enviornment... cfif ThisTag.ExecutionMode EQ "Start" cfset start_time=gettickcount() /cfif cfif ThisTag.ExecutionMode EQ "END" !--- Sane defaults: --- cfparam name="Attributes.Level" default="9" cfparam name="Attributes.Unique" default="#RandRange(1,1000)#" cfparam name="Attributes.Directory" default="c:\temp" !--- set temp dir --- cfset dir_compress = Attributes.Directory cfif not IsDefined("application.IsDir") !--- check if the directory exists --- cfdirectory name="qry_checkdir" directory="#dir_compress#" action="LIST" !--- if it doesn't exist, create new directory #dir_compress# --- cfif not qry_checkdir.recordcount cfdirectory action="CREATE" directory="#dir_compress#" /cfif !--- set IsDir flag for by-passing directory check --- cflock scope="application" timeout="10" cfset application.IsDir = 1 /cflock /cfif !--- Setup path filename for tempfiles: --- cfset RawHTMLFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Uni que#_#RandRang e(1,100)#.out" cfset GZippedFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Uni que#_#RandRang e(1,100)#.in" !--- Grab the generated content and write it out to a tempfile.--- cfset end_time=gettickcount() cfset time = end_time-start_time "Milliseconds" cfset Content = Trim(ThisTag.GeneratedContent) time cffile action="WRITE" file="#RawHTMLFile#" output="#Content#" !--- Compress the tempfile to another tempfile --- cfx_GZip action="GZIP" InFile="#RawHTMLFile#" OutFile="#GZippedFile#" level="#Attributes.Level#" cffile action="delete" file="#RawHTMLFile#" !--- Setup the headers and write the mess back out to the client w/CFCONTENT --- cfset ThisTag.GeneratedContent = "" cfheader name="Content-Encoding" value="gzip" cfcontent file="#GZippedFile#" deletefile="Yes" type="text/html" /cfif -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Monday, December 18, 2000 2:20 PM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 compression is a web server issue NOT CF. That's true, but it doesn't mean you can't do it in CF... Below is a custom tag that will do just that, provided you have CFX_GZip installed (freely downloadable fr
RE: [Compress HTML output]
Hey Zach... After some testing... I implemented your code to test compression of a particularly large html file with some encouraging results... The uncompressed page was 165K and took 391 milliseconds to excute. The compressed page is 20K with an added server overhead of around 375K milliseconds... The savings in download time for the html, in this case, warrent further explortion of compressing certain "heavy" pages (87.8% compression on level 7). Thanks dude! Pretty slick. I've hacked on your code a bit to test it in our development enviornment... cfif ThisTag.ExecutionMode EQ "Start" cfset start_time=gettickcount() /cfif cfif ThisTag.ExecutionMode EQ "END" !--- Sane defaults: --- cfparam name="Attributes.Level" default="9" cfparam name="Attributes.Unique" default="#RandRange(1,1000)#" cfparam name="Attributes.Directory" default="c:\temp" !--- set temp dir --- cfset dir_compress = Attributes.Directory cfif not IsDefined("application.IsDir") !--- check if the directory exists --- cfdirectory name="qry_checkdir" directory="#dir_compress#" action="LIST" !--- if it doesn't exist, create new directory #dir_compress# --- cfif not qry_checkdir.recordcount cfdirectory action="CREATE" directory="#dir_compress#" /cfif !--- set IsDir flag for by-passing directory check --- cflock scope="application" timeout="10" cfset application.IsDir = 1 /cflock /cfif !--- Setup path filename for tempfiles: --- cfset RawHTMLFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Unique#_#RandRang e(1,100)#.out" cfset GZippedFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Unique#_#RandRang e(1,100)#.in" !--- Grab the generated content and write it out to a tempfile.--- cfset end_time=gettickcount() cfset time = end_time-start_time "Milliseconds" cfset Content = Trim(ThisTag.GeneratedContent) time cffile action="WRITE" file="#RawHTMLFile#" output="#Content#" !--- Compress the tempfile to another tempfile --- cfx_GZip action="GZIP" InFile="#RawHTMLFile#" OutFile="#GZippedFile#" level="#Attributes.Level#" cffile action="delete" file="#RawHTMLFile#" !--- Setup the headers and write the mess back out to the client w/CFCONTENT --- cfset ThisTag.GeneratedContent = "" cfheader name="Content-Encoding" value="gzip" cfcontent file="#GZippedFile#" deletefile="Yes" type="text/html" /cfif -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Monday, December 18, 2000 2:20 PM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 compression is a web server issue NOT CF. That's true, but it doesn't mean you can't do it in CF... Below is a custom tag that will do just that, provided you have CFX_GZip installed (freely downloadable from the tag gallery). I'm not sure whether the savings in bandwidth is worth the additional processor power (anyone wanna run tests?), but it's still nifty... One place this would really be a savings: If you already use CFCACHE, you should be able to modify the CFCache tag to also do compression before it saves a file. That way you only need to compress the file once, and you get the processor savings of CFCache AND the bandwidth savings of compression. I'll probably post this tag to the tag gallery once I beat on it for a little longer. In the meantime, enjoy... -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOj5/Z6vhLS1aWPxeEQKSRwCg+iRBf/fA8Y72IbopUMF0kM6NEkkAnj+k wwQDQrb5RkIfgaFn1TRaW8Ub =4/Jb -END PGP SIGNATURE- !--- CF_GZipPage Make sure this tag surrounds the ENTIRE page. It will GZIP the GeneratedContent using CFX_GZip and modify the browser headers so that the browser can decode it. Anything that falls outside of the start and end tag for this tag will be ignored and never seen by the client. Parameters (All are optional): Level: The GZip Compression Level, 0 is lowest compression (biggest size, least processor usage), 9 is highest compression (smallest size, greatest processor usage) Unique: If you'd prefer something more unique than a second random number for tempfiles, specify it here Make sure the contents of the variable are all valid in a filename. CopyLeft 2000 Zachary Bedell [EMAIL PROTECTED] You may use this code as you wish provided I retain credit in the comments or elsewhere.
RE: [Compress HTML output]
I guess that would be CGI.HTTP_ACCEPT_ENCODING. P. -Original Message- From: Peter Stolz [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 19, 2000 10:30 PM To: [EMAIL PROTECTED] Subject: RE: [Compress HTML output] This is great! One question though: The servlet version checks for the ACCEPT_ENCODING request header before it does the actual encoding. I don't know of a way to do this in CF. Any ideas? P. -Original Message- From: Orlando Correa (ITSC) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 19, 2000 9:58 AM To: CF-Talk Subject: RE: [Compress HTML output] Hey Zach... After some testing... I implemented your code to test compression of a particularly large html file with some encouraging results... The uncompressed page was 165K and took 391 milliseconds to excute. The compressed page is 20K with an added server overhead of around 375K milliseconds... The savings in download time for the html, in this case, warrent further explortion of compressing certain "heavy" pages (87.8% compression on level 7). Thanks dude! Pretty slick. I've hacked on your code a bit to test it in our development enviornment... cfif ThisTag.ExecutionMode EQ "Start" cfset start_time=gettickcount() /cfif cfif ThisTag.ExecutionMode EQ "END" !--- Sane defaults: --- cfparam name="Attributes.Level" default="9" cfparam name="Attributes.Unique" default="#RandRange(1,1000)#" cfparam name="Attributes.Directory" default="c:\temp" !--- set temp dir --- cfset dir_compress = Attributes.Directory cfif not IsDefined("application.IsDir") !--- check if the directory exists --- cfdirectory name="qry_checkdir" directory="#dir_compress#" action="LIST" !--- if it doesn't exist, create new directory #dir_compress# --- cfif not qry_checkdir.recordcount cfdirectory action="CREATE" directory="#dir_compress#" /cfif !--- set IsDir flag for by-passing directory check --- cflock scope="application" timeout="10" cfset application.IsDir = 1 /cflock /cfif !--- Setup path filename for tempfiles: --- cfset RawHTMLFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Unique#_#RandRang e(1,100)#.out" cfset GZippedFile = "#dir_compress##listlast(cgi.script_name,"/")#_#Attributes.Unique#_#RandRang e(1,100)#.in" !--- Grab the generated content and write it out to a tempfile.--- cfset end_time=gettickcount() cfset time = end_time-start_time "Milliseconds" cfset Content = Trim(ThisTag.GeneratedContent) time cffile action="WRITE" file="#RawHTMLFile#" output="#Content#" !--- Compress the tempfile to another tempfile --- cfx_GZip action="GZIP" InFile="#RawHTMLFile#" OutFile="#GZippedFile#" level="#Attributes.Level#" cffile action="delete" file="#RawHTMLFile#" !--- Setup the headers and write the mess back out to the client w/CFCONTENT --- cfset ThisTag.GeneratedContent = "" cfheader name="Content-Encoding" value="gzip" cfcontent file="#GZippedFile#" deletefile="Yes" type="text/html" /cfif -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Monday, December 18, 2000 2:20 PM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 compression is a web server issue NOT CF. That's true, but it doesn't mean you can't do it in CF... Below is a custom tag that will do just that, provided you have CFX_GZip installed (freely downloadable from the tag gallery). I'm not sure whether the savings in bandwidth is worth the additional processor power (anyone wanna run tests?), but it's still nifty... One place this would really be a savings: If you already use CFCACHE, you should be able to modify the CFCache tag to also do compression before it saves a file. That way you only need to compress the file once, and you get the processor savings of CFCache AND the bandwidth savings of compression. I'll probably post this tag to the tag gallery once I beat on it for a little longer. In the meantime, enjoy... -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOj5/Z6vhLS1aWPxeEQKSRwCg+iRBf/fA8Y72IbopUMF0kM6NEkkAnj+k wwQDQrb5RkIfgaFn1TRaW8Ub =4/Jb -END PGP SIGNATURE- !--- CF_GZipPage Make sure this tag surrounds the ENTIRE page. It will GZIP the GeneratedContent using CFX_GZip and modify the browser headers so that the browser can decode it. Anything that falls outside of the start and end tag for this tag will be ignored and never seen by the clie
Compress HTML output
Anyone know if ColdFusion supports compressing HTML output on the fly similar to Java? http://coldjava.hypermart.net/servlets/compress.htm Other than using a servlet with ColdFusion? Thanks, Orlando Correa IHS WebTeam Web Applications Developer ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: [Compress HTML output]
compression is a web server issue NOT CF. (www.remotecommunications.com) mod_gzip for apache compresses both static and dynamic pages IIS has compression built in "Correa, Orlando (ITSC)" [EMAIL PROTECTED] wrote: Anyone know if ColdFusion supports compressing HTML output on the fly similar to Java? http://coldjava.hypermart.net/servlets/compress.htm Other than using a servlet with ColdFusion? Thanks, Orlando Correa IHS WebTeam Web Applications Developer ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Compress HTML output
You could write a CFX_J tag that would use the GZip compression and send it. If you're using a Fusebox-style implementation, then you'd encapsulate you're entire page in a custom tag (i.e. CF_HTMLCompress/CF_HTMLCompress.) The custom CF tag would be something like: CFIF ThisTag.ExecutionMode IS "END" CFSET strContent = Trim(ThisTag.GeneratedContent) !---// send to Custom CFX_J tag now //--- !---// clear out the variable so no content is generated to the screen //--- CFSET ThisTag.GeneratedContent = "" /CFIF The basic concept is you'd be capturing all of your page output, sending it to a CFX_J to generate and spit out the code. You might have to generate the encrypting text and display it using CFOUTPUT/CFOUTPUT as well as change the headers being generated with the CFHEADER tags, but I would think it's possible. -Dan -Original Message- From: Correa, Orlando (ITSC) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 18, 2000 2:39 PM To: CF-Talk Subject: Compress HTML output Anyone know if ColdFusion supports compressing HTML output on the fly similar to Java? http://coldjava.hypermart.net/servlets/compress.htm Other than using a servlet with ColdFusion? Thanks, Orlando Correa IHS WebTeam Web Applications Developer ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 compression is a web server issue NOT CF. That's true, but it doesn't mean you can't do it in CF... Below is a custom tag that will do just that, provided you have CFX_GZip installed (freely downloadable from the tag gallery). I'm not sure whether the savings in bandwidth is worth the additional processor power (anyone wanna run tests?), but it's still nifty... One place this would really be a savings: If you already use CFCACHE, you should be able to modify the CFCache tag to also do compression before it saves a file. That way you only need to compress the file once, and you get the processor savings of CFCache AND the bandwidth savings of compression. I'll probably post this tag to the tag gallery once I beat on it for a little longer. In the meantime, enjoy... -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOj5/Z6vhLS1aWPxeEQKSRwCg+iRBf/fA8Y72IbopUMF0kM6NEkkAnj+k wwQDQrb5RkIfgaFn1TRaW8Ub =4/Jb -END PGP SIGNATURE- !--- CF_GZipPage Make sure this tag surrounds the ENTIRE page. It will GZIP the GeneratedContent using CFX_GZip and modify the browser headers so that the browser can decode it. Anything that falls outside of the start and end tag for this tag will be ignored and never seen by the client. Parameters (All are optional): Level: The GZip Compression Level, 0 is lowest compression (biggest size, least processor usage), 9 is highest compression (smallest size, greatest processor usage) Unique: If you'd prefer something more unique than a second random number for tempfiles, specify it here Make sure the contents of the variable are all valid in a filename. CopyLeft 2000 Zachary Bedell [EMAIL PROTECTED] You may use this code as you wish provided I retain credit in the comments or elsewhere. No Warrenty. If it breaks, you get to keep both pieces -ZSB 18-Dec-2000 --- cfif ThisTag.ExecutionMode EQ "END" !--- Sane defaults: --- cfparam name="Attributes.Level" default="9" cfparam name="Attributes.Unique" default="#RandRange(1,1000)#" !--- Setup path filename for tempfiles: --- cfset RawHTMLFile = "c:\Temp\Compress\#Cgi.Script_Name#_#Attributes.Unique#_#RandRange(1,100 )#.out" cfset GZippedFile = "c:\Temp\Compress#Cgi.Script_Name#_#Attributes.Unique#_#RandRange(1,100) #.in" !--- Grab the generated content and write it out to a tempfile. --- cfset Content = Trim(ThisTag.GeneratedContent) cffile action="WRITE" file="#RawHTMLFile#" output="#Content#" !--- Compress the tempfile to another tempfile --- cfx_GZip action="GZIP" InFile="#RawHTMLFile#" OutFile="#GZippedFile#" level="#Attributes.Level#" cffile action="delete" file="#RawHTMLFile#" !--- Setup the headers and write the mess back out to the client w/ CFCONTENT --- cfset ThisTag.GeneratedContent = "" cfheader name="Content-Encoding" value="gzip" cfcontent file="#GZippedFile#" deletefile="Yes" type="text/html" /cfif ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: [Compress HTML output]
Cool... I'll check it out! Thanks for the help. -Original Message- From: Zachary Bedell [mailto:[EMAIL PROTECTED]] Sent: Monday, December 18, 2000 2:20 PM To: CF-Talk Subject: RE: [Compress HTML output] -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 compression is a web server issue NOT CF. That's true, but it doesn't mean you can't do it in CF... Below is a custom tag that will do just that, provided you have CFX_GZip installed (freely downloadable from the tag gallery). I'm not sure whether the savings in bandwidth is worth the additional processor power (anyone wanna run tests?), but it's still nifty... One place this would really be a savings: If you already use CFCACHE, you should be able to modify the CFCache tag to also do compression before it saves a file. That way you only need to compress the file once, and you get the processor savings of CFCache AND the bandwidth savings of compression. I'll probably post this tag to the tag gallery once I beat on it for a little longer. In the meantime, enjoy... -BEGIN PGP SIGNATURE- Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com Comment: Please use PGP! iQA/AwUBOj5/Z6vhLS1aWPxeEQKSRwCg+iRBf/fA8Y72IbopUMF0kM6NEkkAnj+k wwQDQrb5RkIfgaFn1TRaW8Ub =4/Jb -END PGP SIGNATURE- !--- CF_GZipPage Make sure this tag surrounds the ENTIRE page. It will GZIP the GeneratedContent using CFX_GZip and modify the browser headers so that the browser can decode it. Anything that falls outside of the start and end tag for this tag will be ignored and never seen by the client. Parameters (All are optional): Level: The GZip Compression Level, 0 is lowest compression (biggest size, least processor usage), 9 is highest compression (smallest size, greatest processor usage) Unique: If you'd prefer something more unique than a second random number for tempfiles, specify it here Make sure the contents of the variable are all valid in a filename. CopyLeft 2000 Zachary Bedell [EMAIL PROTECTED] You may use this code as you wish provided I retain credit in the comments or elsewhere. No Warrenty. If it breaks, you get to keep both pieces -ZSB 18-Dec-2000 --- cfif ThisTag.ExecutionMode EQ "END" !--- Sane defaults: --- cfparam name="Attributes.Level" default="9" cfparam name="Attributes.Unique" default="#RandRange(1,1000)#" !--- Setup path filename for tempfiles: --- cfset RawHTMLFile = "c:\Temp\Compress\#Cgi.Script_Name#_#Attributes.Unique#_#RandRange(1,100 )#.out" cfset GZippedFile = "c:\Temp\Compress#Cgi.Script_Name#_#Attributes.Unique#_#RandRange(1,100) #.in" !--- Grab the generated content and write it out to a tempfile. --- cfset Content = Trim(ThisTag.GeneratedContent) cffile action="WRITE" file="#RawHTMLFile#" output="#Content#" !--- Compress the tempfile to another tempfile --- cfx_GZip action="GZIP" InFile="#RawHTMLFile#" OutFile="#GZippedFile#" level="#Attributes.Level#" cffile action="delete" file="#RawHTMLFile#" !--- Setup the headers and write the mess back out to the client w/ CFCONTENT --- cfset ThisTag.GeneratedContent = "" cfheader name="Content-Encoding" value="gzip" cfcontent file="#GZippedFile#" deletefile="Yes" type="text/html" /cfif ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists