Apache::Dynagzip not seeing my headers from Apache::Registry script

[prev] [thread] [next] [Date index for 2004/12/24]

From: Alex Greg
Subject: Apache::Dynagzip not seeing my headers from Apache::Registry script
Date: 23:34 on 24 Dec 2004
Hi,


I've been trying for most of the evening to get Apache::Dynagzip
working with Apache::Registry. I've gotten to the point whereby it
works fine (compresses the content or not depending on the browser),
but it sets the default Content-Type to text/html and disregards the
headers I send from my script.


The code below produces the following when called from a non-gzip browser:


#!/usr/local/bin/perl

use strict;

my $r = Apache->request;

my $var;

open(FILE, "text.txt");

while (<FILE>)
{
        $var .= $_;
}

close(FILE);

$r->content_type("text/plain");
$r->send_http_header;

print $var;


Response:

Date: Fri, 24 Dec 2004 23:22:57 GMT
Server: Apache
X-Module-Sender: Apache::Dynagzip
Expires: Friday, 24-December-2004 23:27:57 GMT
Transfer-Encoding: chunked
Connection: close
Content-Type: text/html

213c
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut tempor
bibendum ante. Donec rutrum. Cras semper neque in tellus. Pellentesque
blandit magna in nisl. Quisque dignissim cursus ligula. Curabitur
augue nunc, varius in, faucibus ac, ultrices quis, nisl.....


Note that Apache::Dynagzip is setting the header to the default
text/html even though I have explicitly set it to text/plain. The
following debug is from the error log:


[Fri Dec 24 23:29:10 2004] [info] [client 192.168.1.6]
Apache::Dynagzip default_content_handler is serving the main request
for GET /cgi-bin/blah.cgi HTTP/1.1 targeting /www/cgi-bin/blah.cgi via
/cgi-bin/blah.cgi Light Compression is Off. Source comes from Filter
Chain. The client  does not accept GZIP.
[Fri Dec 24 23:29:10 2004] [info] [client 192.168.1.6]
Apache::Dynagzip default_content_handler no gzip for GET
/cgi-bin/blah.cgi HTTP/1.1 min_chunk_size=8192
[Fri Dec 24 23:29:10 2004] [debug]
/usr/lib/perl5/site_perl/5.8.3/Apache/Dynagzip.pm(917): [client
192.168.1.6] Apache::Dynagzip default_content_handler creates default
Content-Type for GET /cgi-bin/blah.cgi HTTP/1.1
[Fri Dec 24 23:29:10 2004] [info] [client 192.168.1.6]
Apache::Dynagzip default_content_handler is done OK for
/www/cgi-bin/blah.cgi 40172 bytes sent


What's even stranger is when I use the same check that Dynagzip uses
to see if the Content-Type is set, it fails. Appending this to my
script:

if ($r->header_out("Content-type"))
{
        warn "Headers sent OK";
}
else
{
        warn "Headers NOT sent OK";
}


Results in the following in the error log:


Headers NOT sent OK at /www/cgi-bin/blah.cgi line 29.


My Apache configuration is as follows:


<Directory "/www/cgi-bin">
        SetHandler perl-script
        PerlHandler Apache::RegistryFilter Apache::Dynagzip
        PerlSetVar Filter On
        PerlSendHeader Off
        PerlSetupEnv On
        AllowOverride AuthConfig
        Options +ExecCGI
</Directory>


Any advice on this would be much appreciated, as I have been banging
my head against it all evening!


-- Alex

        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Apache::Dynagzip not seeing my headers from Apache::Registry script
Alex Greg 23:34 on 24 Dec 2004

Generated at 12:16 on 16 Jan 2005 by mariachi v0.52