|
Joined: Jan 2003
Posts: 118
Member
|
Member
Joined: Jan 2003
Posts: 118 |
What would I need to add to ubb_status.cgi, poll_ssi.cgi, ubb_hits.cgi, ubb_checkmsg.cgi in order for them to get the same benefit?
Does this work for PHP and/or Javascript like the Newsfader?
-GATOR
"Pain is temporary, Pride is forever"
|
|
|
|
Joined: Jan 2003
Posts: 3,456 Likes: 2
Master Hacker
|
Master Hacker
Joined: Jan 2003
Posts: 3,456 Likes: 2 |
not needed for javascript and the PHP accelerator does it already
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
Originally posted by Brett:
I have applied this to all my applications on the Alltel intranet. It chopped a 124k page to 13.2k. I know all here who deal with large pages/apps, taxing the server at every turn, any letup is greatly appreciated. Great job to all those involved!
If you write your own code I have a suggestion; use only a single print for output. This way, you do not need any 3rd party buffering module like this  and it'll be easy to port to platforms like mod_perl. Originally posted by AllenAyres: [qb] I'm seeing 65kb (66009 bytes) in IE and 6.7kb in firefox on the xbox site. [/qb] There are several alternatives in CPAN, which basicaly do the same thing: buffer STDOUT, split body and headers and gzip body. And they may be better than this "cgi_buffer" -- I don't like the coding. But this one ( http://search.cpan.org/dist/CGI-WebGzip/ ) gives a nice idea to display the compressed size  If you send a cookie only for this operation, you can even display compression ratio. For eaxample this will probably do the trick: if ($cgi_buffer::compress_content) { foreach $encoding ('x-gzip', 'gzip') { $_ = lc($ENV{'HTTP_ACCEPT_ENCODING'}); if ( m/$encoding/i && lc($content_type[0]) eq 'text') { my $size_normal = length($body); $body = Compress::Zlib::memGzip($body); my $size_gzip = length($body); my $ubb_gzipr = sprintf("%.2f",100-($size_gzip * 100 / $size_normal)); push @o, "Content-Encoding: $encoding"; push @o, "Vary: Accept-Encoding"; push @o, "Set-Cookie: UBBGZIPRATIO=$ubb_gzipr; path=/"; last; } } } You can then use a javascript function to read "UBBGZIPRATIO" cookie: <script>document.write("Page compression ratio: "+read_cookie('UBBGZIPRATIO'))</script>
|
|
|
|
Joined: Jan 2003
Posts: 3,456 Likes: 2
Master Hacker
|
Master Hacker
Joined: Jan 2003
Posts: 3,456 Likes: 2 |
If you can write a better version of this mod, please do. I only ported this from the old version, and wouldn't be suprised if I did that poorly.
|
|
|
|
Joined: Mar 2000
Posts: 21,079 Likes: 3
I type Like navaho
|
I type Like navaho
Joined: Mar 2000
Posts: 21,079 Likes: 3 |
And the old one is based on a module 4+ years old 
|
|
|
|
Joined: May 2000
Posts: 1,356
Addict
|
Addict
Joined: May 2000
Posts: 1,356 |
Originally posted by Ian Spence:
If you can write a better version of this mod, please do. I only ported this from the old version, and wouldn't be suprised if I did that poorly.
No, I can't write a better version  since the concept is the same and a little further can be done. But there are better alternatives like CGI::WebGzip. It auto-checks the existence of Compress::Zlib and does not require any other module like "IO::String" or MD5 Also there is this one: http://search.cpan.org/dist/CGI-Compress-Gzip but it requires IO::Zlib There may be some other modules...
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 69
Joined: January 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|