Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Joined: Jan 2003
Posts: 118
Member
Member
Offline
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"
Sponsored Links
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
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
Quote
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. smile

Great job to all those involved! thumbsup



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 smile 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 smile If you send a cookie only for this operation, you can even display compression ratio.

For eaxample this will probably do the trick:

Code
	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:

Code
<script>document.write("Page compression ratio: "+read_cookie('UBBGZIPRATIO'))</script>

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
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 smile


- Allen wavey
- What Drives You?
Sponsored Links
Joined: May 2000
Posts: 1,356
Addict
Addict
Joined: May 2000
Posts: 1,356
Quote
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 smile 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 smile

Also there is this one: http://search.cpan.org/dist/CGI-Compress-Gzip but it requires IO::Zlib

There may be some other modules...

Page 2 of 2 1 2

Link Copied to Clipboard
Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
hatter
hatter
USA
Posts: 69
Joined: January 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)