You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Scott Alexander <mo...@humak.edu> on 2003/05/26 09:39:51 UTC

gzipchain

Hi,

What am I doing when when I get see only part of the html source in the
browser.

eg I see <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"><html><head>

and that's all. (Actually it's the output of the first print statement)

I have in httpd.conf

<Directory /usr/local/systems/work/>
 PerlSendHeader On
 SetHandler perl-script
 PerlHandler Apache::OutputChain Apache::GzipChain Apache::Registry
 Options +ExecCGI

There is no error warnings in apache error log.

I'm using NN 7+ and same happens in IE6


Regards

Scott Alexander




Re: gzipchain

Posted by Slava Bizyayev <sb...@outlook.net>.
Hi Scott,

In my understanding your script responds correctly from the configuration

<Directory /usr/local/systems/work/>

       PerlSendHeader On
       SetHandler perl-script
       PerlHandler Apache::Registry
       Options +ExecCGI
        # AUTH
        AuthType Apache::Authenticate
AuthName protected
PerlAccessHandler Apache::OpenAccess
PerlAuthenHandler Apache::Authenticate->authenticate
require valid-user

</Directory>

Please, let me know if I'm wrong.

Assuming it does, you would probably better try the following replacement:

<Directory /usr/local/systems/work/>

       PerlSendHeader On
       SetHandler perl-script
       PerlHandler Apache::RegistryFilter Apache::Dynagzip
       PerlSetVar Filter On
       PerlSetVar LightCompression On
       Options +ExecCGI
        # AUTH
        AuthType Apache::Authenticate
AuthName protected
PerlAccessHandler Apache::OpenAccess
PerlAuthenHandler Apache::Authenticate->authenticate
require valid-user

</Directory>

It should compress all output from this directory.

When you need to distinguish compression between different types of output,
it's the most simple solution to run each type of outgoing content from the
own directory. You might have one compressed directory and one plain then.
Otherwise you need to write your own fixup handler to turn compression off
dynamically.

Please let me know if it works for you.

Thanks,
Slava

----- Original Message ----- 
From: "Scott Alexander" <mo...@humak.edu>
To: <mo...@perl.apache.org>
Sent: Tuesday, May 27, 2003 11:04 PM
Subject: Re: gzipchain


> On Mon, 26 May 2003, Perrin Harkins wrote:
>
> > Scott Alexander wrote:
> > > Yes if I join all my output using
> > >
> > > $print = $print . "html source"
> > >
> > > and then one print at the end
> > >
> > > AND change my script name from script.pl to script.html it works.
> > >
> > > The script I experimented on went from 15000 bytes down to 2900 bytes!
> > >
> > > Do I have to change all my scripts from pl to html ?
> > > And why must I have everything in one print statement for it to work?
> >
> > I'm not sure why those changes helped, but you should know that
> > Apache::GzipChain is not in wide use anymore.  Most people use either
> > Apache::Compress or Apache::Dynagzip.  You can read more about them
here:
> >
http://perl.apache.org/docs/tutorials/client/compression/compression.html
> >
> > - Perrin
>
> Okay thanks now I'm using Dynagzip. The results are quite impressive.
>
> Some of my scripts output rtf or csv. The user can select the output
> format (html/csv) so depending on their selection I need to have
> compression turned off. Some scripts only output rtf. All my scripts have
> the extension 'pl'.
>
> I have tried $r->dir_config->set(Filter => 'Off') ; if user script outputs
> rtf.
>
> Is there some way I can turn off compression for certain scripts. I could
> rename the extension for scripts that I don't want compression, but in the
> case where the user can select the output then those scripts won't benefit
> from compression. It would be easier to turn it off dynamically than to
> rename my scripts, links, <form action=''> etc etc.
>
> Also why does IE 6 display different html code compared to Netscape?
>
> Netscape displays it correctly, but IE only displays '</body></html' at
> the end. It's always missing the last '>'
>
> My httpd.conf is
>
> <Directory /usr/local/systems/work/>
>
>        PerlSendHeader On
>        SetHandler perl-script
>        PerlHandler Apache::Registry
>        Options +ExecCGI
>
>         ## DYNAGZIP
>         <Files *.pl>
>             SetHandler perl-script
>             PerlHandler Apache::RegistryFilter Apache::Dynagzip
>             PerlSetVar Filter On
>             PerlSetVar UseCGIHeadersFromScript Off
>             PerlSendHeader Off
>             PerlSetupEnv On
>             PerlSetVar LightCompression On
>         </Files>
>
>
>         # AUTH
>         AuthType Apache::Authenticate
> AuthName protected
> PerlAccessHandler Apache::OpenAccess
> PerlAuthenHandler Apache::Authenticate->authenticate
> require valid-user
>
> </Directory>
>
>
> Scott
>
>


Re: gzipchain

Posted by Slava Bizyayev <sb...@outlook.net>.
I guess, handler development will not be much easier for you.. Have you read
Eagle Book?

Thanks,
Slava

----- Original Message ----- 
From: "Scott Alexander" <mo...@humak.edu>
To: <mo...@perl.apache.org>
Sent: Wednesday, May 28, 2003 1:01 AM
Subject: Re: gzipchain


> On Wed, 28 May 2003, Slava Bizyayev wrote:
>
> Yes it does work with my current configuration. Note I had <Files *.pl>
> inside of <Directory /usr/local/systems/work/>
>
> Having different directories (one for compression, one not) is
> messy in my case.
>
> What about the idea of a fixup handler? In scripts that the user selects
> to output in csv or rtf I could use
> $r->dir->config->set(Script_Compression => 'Off') ; then my fixup handler
> look for that value and turn off compression. But how do I actually turn
> off compression?
>
> The scripts that always output rtf I will rename to a new extension, but
> the scripts users can select the output then I must use a fixup
> handler.
>
> Also why does my own Content-type: text/html turn up in output? I guess
> dynagzip is setting it's own content-type header.
>
>
> Scott
>
> > Hi Scott,
> >
> > In my understanding your script responds correctly from the
configuration
> >
> > <Directory /usr/local/systems/work/>
> >
> >        PerlSendHeader On
> >        SetHandler perl-script
> >        PerlHandler Apache::Registry
> >        Options +ExecCGI
> >         # AUTH
> >         AuthType Apache::Authenticate
> > AuthName protected
> > PerlAccessHandler Apache::OpenAccess
> > PerlAuthenHandler Apache::Authenticate->authenticate
> > require valid-user
> >
> > </Directory>
> >
> > Please, let me know if I'm wrong.
> >
> > Assuming it does, you would probably better try the following
replacement:
> >
> > <Directory /usr/local/systems/work/>
> >
> >        PerlSendHeader On
> >        SetHandler perl-script
> >        PerlHandler Apache::RegistryFilter Apache::Dynagzip
> >        PerlSetVar Filter On
> >        PerlSetVar LightCompression On
> >        Options +ExecCGI
> >         # AUTH
> >         AuthType Apache::Authenticate
> > AuthName protected
> > PerlAccessHandler Apache::OpenAccess
> > PerlAuthenHandler Apache::Authenticate->authenticate
> > require valid-user
> >
> > </Directory>
> >
> > It should compress all output from this directory.
> >
> > When you need to distinguish compression between different types of
output,
> > it's the most simple solution to run each type of outgoing content from
the
> > own directory. You might have one compressed directory and one plain
then.
> > Otherwise you need to write your own fixup handler to turn compression
off
> > dynamically.
> >
> > Please let me know if it works for you.
> >
> > Thanks,
> > Slava
> >
> > ----- Original Message -----
> > From: "Scott Alexander" <mo...@humak.edu>
> > To: <mo...@perl.apache.org>
> > Sent: Tuesday, May 27, 2003 11:04 PM
> > Subject: Re: gzipchain
> >
> >
> > > On Mon, 26 May 2003, Perrin Harkins wrote:
> > >
> > > > Scott Alexander wrote:
> > > > > Yes if I join all my output using
> > > > >
> > > > > $print = $print . "html source"
> > > > >
> > > > > and then one print at the end
> > > > >
> > > > > AND change my script name from script.pl to script.html it works.
> > > > >
> > > > > The script I experimented on went from 15000 bytes down to 2900
bytes!
> > > > >
> > > > > Do I have to change all my scripts from pl to html ?
> > > > > And why must I have everything in one print statement for it to
work?
> > > >
> > > > I'm not sure why those changes helped, but you should know that
> > > > Apache::GzipChain is not in wide use anymore.  Most people use
either
> > > > Apache::Compress or Apache::Dynagzip.  You can read more about them
> > here:
> > > >
> >
http://perl.apache.org/docs/tutorials/client/compression/compression.html
> > > >
> > > > - Perrin
> > >
> > > Okay thanks now I'm using Dynagzip. The results are quite impressive.
> > >
> > > Some of my scripts output rtf or csv. The user can select the output
> > > format (html/csv) so depending on their selection I need to have
> > > compression turned off. Some scripts only output rtf. All my scripts
have
> > > the extension 'pl'.
> > >
> > > I have tried $r->dir_config->set(Filter => 'Off') ; if user script
outputs
> > > rtf.
> > >
> > > Is there some way I can turn off compression for certain scripts. I
could
> > > rename the extension for scripts that I don't want compression, but in
the
> > > case where the user can select the output then those scripts won't
benefit
> > > from compression. It would be easier to turn it off dynamically than
to
> > > rename my scripts, links, <form action=''> etc etc.
> > >
> > > Also why does IE 6 display different html code compared to Netscape?
> > >
> > > Netscape displays it correctly, but IE only displays '</body></html'
at
> > > the end. It's always missing the last '>'
> > >
> > > My httpd.conf is
> > >
> > > <Directory /usr/local/systems/work/>
> > >
> > >        PerlSendHeader On
> > >        SetHandler perl-script
> > >        PerlHandler Apache::Registry
> > >        Options +ExecCGI
> > >
> > >         ## DYNAGZIP
> > >         <Files *.pl>
> > >             SetHandler perl-script
> > >             PerlHandler Apache::RegistryFilter Apache::Dynagzip
> > >             PerlSetVar Filter On
> > >             PerlSetVar UseCGIHeadersFromScript Off
> > >             PerlSendHeader Off
> > >             PerlSetupEnv On
> > >             PerlSetVar LightCompression On
> > >         </Files>
> > >
> > >
> > >         # AUTH
> > >         AuthType Apache::Authenticate
> > > AuthName protected
> > > PerlAccessHandler Apache::OpenAccess
> > > PerlAuthenHandler Apache::Authenticate->authenticate
> > > require valid-user
> > >
> > > </Directory>
> > >
> > >
> > > Scott
> > >
> > >
> >
>
>


Re: gzipchain

Posted by Scott Alexander <mo...@humak.edu>.
On Wed, 28 May 2003, Slava Bizyayev wrote:

Yes it does work with my current configuration. Note I had <Files *.pl>
inside of <Directory /usr/local/systems/work/>

Having different directories (one for compression, one not) is
messy in my case.

What about the idea of a fixup handler? In scripts that the user selects
to output in csv or rtf I could use
$r->dir->config->set(Script_Compression => 'Off') ; then my fixup handler
look for that value and turn off compression. But how do I actually turn
off compression?

The scripts that always output rtf I will rename to a new extension, but
the scripts users can select the output then I must use a fixup
handler.

Also why does my own Content-type: text/html turn up in output? I guess
dynagzip is setting it's own content-type header.


Scott

> Hi Scott,
>
> In my understanding your script responds correctly from the configuration
>
> <Directory /usr/local/systems/work/>
>
>        PerlSendHeader On
>        SetHandler perl-script
>        PerlHandler Apache::Registry
>        Options +ExecCGI
>         # AUTH
>         AuthType Apache::Authenticate
> AuthName protected
> PerlAccessHandler Apache::OpenAccess
> PerlAuthenHandler Apache::Authenticate->authenticate
> require valid-user
>
> </Directory>
>
> Please, let me know if I'm wrong.
>
> Assuming it does, you would probably better try the following replacement:
>
> <Directory /usr/local/systems/work/>
>
>        PerlSendHeader On
>        SetHandler perl-script
>        PerlHandler Apache::RegistryFilter Apache::Dynagzip
>        PerlSetVar Filter On
>        PerlSetVar LightCompression On
>        Options +ExecCGI
>         # AUTH
>         AuthType Apache::Authenticate
> AuthName protected
> PerlAccessHandler Apache::OpenAccess
> PerlAuthenHandler Apache::Authenticate->authenticate
> require valid-user
>
> </Directory>
>
> It should compress all output from this directory.
>
> When you need to distinguish compression between different types of output,
> it's the most simple solution to run each type of outgoing content from the
> own directory. You might have one compressed directory and one plain then.
> Otherwise you need to write your own fixup handler to turn compression off
> dynamically.
>
> Please let me know if it works for you.
>
> Thanks,
> Slava
>
> ----- Original Message -----
> From: "Scott Alexander" <mo...@humak.edu>
> To: <mo...@perl.apache.org>
> Sent: Tuesday, May 27, 2003 11:04 PM
> Subject: Re: gzipchain
>
>
> > On Mon, 26 May 2003, Perrin Harkins wrote:
> >
> > > Scott Alexander wrote:
> > > > Yes if I join all my output using
> > > >
> > > > $print = $print . "html source"
> > > >
> > > > and then one print at the end
> > > >
> > > > AND change my script name from script.pl to script.html it works.
> > > >
> > > > The script I experimented on went from 15000 bytes down to 2900 bytes!
> > > >
> > > > Do I have to change all my scripts from pl to html ?
> > > > And why must I have everything in one print statement for it to work?
> > >
> > > I'm not sure why those changes helped, but you should know that
> > > Apache::GzipChain is not in wide use anymore.  Most people use either
> > > Apache::Compress or Apache::Dynagzip.  You can read more about them
> here:
> > >
> http://perl.apache.org/docs/tutorials/client/compression/compression.html
> > >
> > > - Perrin
> >
> > Okay thanks now I'm using Dynagzip. The results are quite impressive.
> >
> > Some of my scripts output rtf or csv. The user can select the output
> > format (html/csv) so depending on their selection I need to have
> > compression turned off. Some scripts only output rtf. All my scripts have
> > the extension 'pl'.
> >
> > I have tried $r->dir_config->set(Filter => 'Off') ; if user script outputs
> > rtf.
> >
> > Is there some way I can turn off compression for certain scripts. I could
> > rename the extension for scripts that I don't want compression, but in the
> > case where the user can select the output then those scripts won't benefit
> > from compression. It would be easier to turn it off dynamically than to
> > rename my scripts, links, <form action=''> etc etc.
> >
> > Also why does IE 6 display different html code compared to Netscape?
> >
> > Netscape displays it correctly, but IE only displays '</body></html' at
> > the end. It's always missing the last '>'
> >
> > My httpd.conf is
> >
> > <Directory /usr/local/systems/work/>
> >
> >        PerlSendHeader On
> >        SetHandler perl-script
> >        PerlHandler Apache::Registry
> >        Options +ExecCGI
> >
> >         ## DYNAGZIP
> >         <Files *.pl>
> >             SetHandler perl-script
> >             PerlHandler Apache::RegistryFilter Apache::Dynagzip
> >             PerlSetVar Filter On
> >             PerlSetVar UseCGIHeadersFromScript Off
> >             PerlSendHeader Off
> >             PerlSetupEnv On
> >             PerlSetVar LightCompression On
> >         </Files>
> >
> >
> >         # AUTH
> >         AuthType Apache::Authenticate
> > AuthName protected
> > PerlAccessHandler Apache::OpenAccess
> > PerlAuthenHandler Apache::Authenticate->authenticate
> > require valid-user
> >
> > </Directory>
> >
> >
> > Scott
> >
> >
>


Re: gzipchain

Posted by Slava Bizyayev <sb...@outlook.net>.
Hi Scott,

In my understanding your script responds correctly from the configuration

<Directory /usr/local/systems/work/>

       PerlSendHeader On
       SetHandler perl-script
       PerlHandler Apache::Registry
       Options +ExecCGI
        # AUTH
        AuthType Apache::Authenticate
AuthName protected
PerlAccessHandler Apache::OpenAccess
PerlAuthenHandler Apache::Authenticate->authenticate
require valid-user

</Directory>

Please, let me know if I'm wrong.

Assuming it does, you would probably better try the following replacement:

<Directory /usr/local/systems/work/>

       PerlSendHeader On
       SetHandler perl-script
       PerlHandler Apache::RegistryFilter Apache::Dynagzip
       PerlSetVar Filter On
       PerlSetVar LightCompression On
       Options +ExecCGI
        # AUTH
        AuthType Apache::Authenticate
AuthName protected
PerlAccessHandler Apache::OpenAccess
PerlAuthenHandler Apache::Authenticate->authenticate
require valid-user

</Directory>

It should compress all output from this directory.

When you need to distinguish compression between different types of output,
it's the most simple solution to run each type of outgoing content from the
own directory. You might have one compressed directory and one plain then.
Otherwise you need to write your own fixup handler to turn compression off
dynamically.

Please let me know if it works for you.

Thanks,
Slava

----- Original Message ----- 
From: "Scott Alexander" <mo...@humak.edu>
To: <mo...@perl.apache.org>
Sent: Tuesday, May 27, 2003 11:04 PM
Subject: Re: gzipchain


> On Mon, 26 May 2003, Perrin Harkins wrote:
>
> > Scott Alexander wrote:
> > > Yes if I join all my output using
> > >
> > > $print = $print . "html source"
> > >
> > > and then one print at the end
> > >
> > > AND change my script name from script.pl to script.html it works.
> > >
> > > The script I experimented on went from 15000 bytes down to 2900 bytes!
> > >
> > > Do I have to change all my scripts from pl to html ?
> > > And why must I have everything in one print statement for it to work?
> >
> > I'm not sure why those changes helped, but you should know that
> > Apache::GzipChain is not in wide use anymore.  Most people use either
> > Apache::Compress or Apache::Dynagzip.  You can read more about them
here:
> >
http://perl.apache.org/docs/tutorials/client/compression/compression.html
> >
> > - Perrin
>
> Okay thanks now I'm using Dynagzip. The results are quite impressive.
>
> Some of my scripts output rtf or csv. The user can select the output
> format (html/csv) so depending on their selection I need to have
> compression turned off. Some scripts only output rtf. All my scripts have
> the extension 'pl'.
>
> I have tried $r->dir_config->set(Filter => 'Off') ; if user script outputs
> rtf.
>
> Is there some way I can turn off compression for certain scripts. I could
> rename the extension for scripts that I don't want compression, but in the
> case where the user can select the output then those scripts won't benefit
> from compression. It would be easier to turn it off dynamically than to
> rename my scripts, links, <form action=''> etc etc.
>
> Also why does IE 6 display different html code compared to Netscape?
>
> Netscape displays it correctly, but IE only displays '</body></html' at
> the end. It's always missing the last '>'
>
> My httpd.conf is
>
> <Directory /usr/local/systems/work/>
>
>        PerlSendHeader On
>        SetHandler perl-script
>        PerlHandler Apache::Registry
>        Options +ExecCGI
>
>         ## DYNAGZIP
>         <Files *.pl>
>             SetHandler perl-script
>             PerlHandler Apache::RegistryFilter Apache::Dynagzip
>             PerlSetVar Filter On
>             PerlSetVar UseCGIHeadersFromScript Off
>             PerlSendHeader Off
>             PerlSetupEnv On
>             PerlSetVar LightCompression On
>         </Files>
>
>
>         # AUTH
>         AuthType Apache::Authenticate
> AuthName protected
> PerlAccessHandler Apache::OpenAccess
> PerlAuthenHandler Apache::Authenticate->authenticate
> require valid-user
>
> </Directory>
>
>
> Scott
>
>


Re: gzipchain

Posted by Scott Alexander <mo...@humak.edu>.
On Mon, 26 May 2003, Perrin Harkins wrote:

> Scott Alexander wrote:
> > Yes if I join all my output using
> >
> > $print = $print . "html source"
> >
> > and then one print at the end
> >
> > AND change my script name from script.pl to script.html it works.
> >
> > The script I experimented on went from 15000 bytes down to 2900 bytes!
> >
> > Do I have to change all my scripts from pl to html ?
> > And why must I have everything in one print statement for it to work?
>
> I'm not sure why those changes helped, but you should know that
> Apache::GzipChain is not in wide use anymore.  Most people use either
> Apache::Compress or Apache::Dynagzip.  You can read more about them here:
> http://perl.apache.org/docs/tutorials/client/compression/compression.html
>
> - Perrin

Okay thanks now I'm using Dynagzip. The results are quite impressive.

Some of my scripts output rtf or csv. The user can select the output
format (html/csv) so depending on their selection I need to have
compression turned off. Some scripts only output rtf. All my scripts have
the extension 'pl'.

I have tried $r->dir_config->set(Filter => 'Off') ; if user script outputs
rtf.

Is there some way I can turn off compression for certain scripts. I could
rename the extension for scripts that I don't want compression, but in the
case where the user can select the output then those scripts won't benefit
from compression. It would be easier to turn it off dynamically than to
rename my scripts, links, <form action=''> etc etc.

Also why does IE 6 display different html code compared to Netscape?

Netscape displays it correctly, but IE only displays '</body></html' at
the end. It's always missing the last '>'

My httpd.conf is

<Directory /usr/local/systems/work/>

       PerlSendHeader On
       SetHandler perl-script
       PerlHandler Apache::Registry
       Options +ExecCGI

        ## DYNAGZIP
        <Files *.pl>
            SetHandler perl-script
            PerlHandler Apache::RegistryFilter Apache::Dynagzip
            PerlSetVar Filter On
            PerlSetVar UseCGIHeadersFromScript Off
            PerlSendHeader Off
            PerlSetupEnv On
            PerlSetVar LightCompression On
        </Files>


        # AUTH
        AuthType Apache::Authenticate
	AuthName protected
	PerlAccessHandler Apache::OpenAccess
	PerlAuthenHandler Apache::Authenticate->authenticate
	require valid-user

</Directory>


Scott


Re: gzipchain

Posted by Perrin Harkins <pe...@elem.com>.
Scott Alexander wrote:
> Yes if I join all my output using
> 
> $print = $print . "html source"
> 
> and then one print at the end
> 
> AND change my script name from script.pl to script.html it works.
> 
> The script I experimented on went from 15000 bytes down to 2900 bytes!
> 
> Do I have to change all my scripts from pl to html ?
> And why must I have everything in one print statement for it to work?

I'm not sure why those changes helped, but you should know that 
Apache::GzipChain is not in wide use anymore.  Most people use either 
Apache::Compress or Apache::Dynagzip.  You can read more about them here:
http://perl.apache.org/docs/tutorials/client/compression/compression.html

- Perrin


Re: gzipchain

Posted by Scott Alexander <mo...@humak.edu>.
On Mon, 26 May 2003, Scott Alexander wrote:


Yes if I join all my output using

$print = $print . "html source"

and then one print at the end

AND change my script name from script.pl to script.html it works.

The script I experimented on went from 15000 bytes down to 2900 bytes!

Do I have to change all my scripts from pl to html ?
And why must I have everything in one print statement for it to work?

Scott

> Hi,
>
> What am I doing when when I get see only part of the html source in the
> browser.
>
> eg I see <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
> Transitional//EN"><html><head>
>
> and that's all. (Actually it's the output of the first print statement)
>
> I have in httpd.conf
>
> <Directory /usr/local/systems/work/>
>  PerlSendHeader On
>  SetHandler perl-script
>  PerlHandler Apache::OutputChain Apache::GzipChain Apache::Registry
>  Options +ExecCGI
>
> There is no error warnings in apache error log.
>
> I'm using NN 7+ and same happens in IE6
>
>
> Regards
>
> Scott Alexander
>
>
>