Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

Apache Client Filehandle

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


leo-mod-perl at secline

Jan 27, 2005, 6:27 AM

Post #1 of 3 (317 views)
Permalink
Apache Client Filehandle

Hello all:

I want to use Compress::Zlib to deflate contents being sent to the client.

One way is using it's gzopen(<file or filehandle>, <mode>) call.

Is there a filehandle that represents the output stream to the client?

How do I get it?

I am writing my own mod_perl handler for Apache2 (mod_perl2.0 from svs)

Thanks in advance,

Leo


geoff at modperlcookbook

Jan 27, 2005, 6:30 AM

Post #2 of 3 (254 views)
Permalink
Re: Apache Client Filehandle [In reply to]

Leo wrote:
> Hello all:
>
> I want to use Compress::Zlib to deflate contents being sent to the client.
>
> One way is using it's gzopen(<file or filehandle>, <mode>) call.
>
> Is there a filehandle that represents the output stream to the client?
>
> How do I get it?
>
> I am writing my own mod_perl handler for Apache2 (mod_perl2.0 from svs)

if you're using apache 2 then just use mod_deflate - that's what it is for.

http://httpd.apache.org/docs-2.0/mod/mod_deflate.html

unlike with apache 1.3/mod_perl 1.0, mod_deflate will compress all output on
the way to the client, even dynamically generated scripts or content handlers.

HTH

--Geoff


geoff at modperlcookbook

Jan 27, 2005, 9:00 AM

Post #3 of 3 (252 views)
Permalink
Re: Apache Client Filehandle [In reply to]

please keep posts on-list so everyone can benefit :)

> Thanks for the sugestion; my handler has a flag that is set in an
> application specific config file (not the apache.conf or any included
> files therein) that should be able to turn off compression.

what you could do in that case is just disable mod_deflate:

$r->subprocess_env('no-gzip' => 1) if $some_custom_condition;

the trick is, you need to do it before the PerlResponseHandler phase, such
as from a PerlFixupHandler.

>
> My module may even cache it's contents...
>
> Seems that to use mod_deflate with my application specific flag, I'll
> have to reconfigure the server config of mod_deflate at runtime whenever
> the flag is overriding the default right?

no, not the server config. see above :)

HTH

--Geoff

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.