Please Alex, "reply to all" in order to keep the thread on list. I believe that Ken Williams could give you a more precise advise since I'm always writing pure Apache handlers in similar cases, but just in order to give a quick try I would suggest to register the input too. I'm not quite sure, but to the best of my knowledge your script becomes a part of the Apache::RegistryFilter since you are inside the Apache::Filter chain, and you should get your input in accordance with the Apache::Filter rules. However, I might be wrong on that, and we'll have to wait for Ken then.
Good luck! Slava On Fri, 2004-12-24 at 19:59, Alex Greg wrote: > On 24 Dec 2004 18:47:15 -0600, Slava Bizyayev <[EMAIL PROTECTED]> wrote: > > Hi Alex, > > > > Your problem is originated from the fact that your code is not > > compatible with the Apache::Filter chain that you are trying to use. > > Apache::Dynagzip does not see your header because Apache::RegistryFilter > > does not allow it to get through. That's why Apache::Dynagzip sets up > > the default Content-Type. > > > > Please take a look at the Apache::Filter documentation in order to > > register you script with the Apache::RegistryFilter properly. > > Hi Slava, > > > Thanks for your reply. I've now registered my script with > Apache::Filter as follows: > > > #!/usr/local/bin/perl > > use strict; > > my $r = Apache->request; > > $r = $r->filter_register; > > > my $var; > > open(FILE, "text.txt"); > > while (<FILE>) > { > $var .= $_; > } > > close(FILE); > > $r->content_type("text/plain"); > $r->send_http_header; > > print $var; > > > Unfortunately, I now get this in my error log: > > > Not a HASH reference at > /usr/lib/perl5/site_perl/5.8.3/Apache/Filter.pm line 197. > > > Any ideas? > > > Thanks, > > > -- Alex > > > > On Fri, 2004-12-24 at 17:34, Alex Greg wrote: > > > 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