Apache::Filter and cookies

2001-04-10 Thread JR Mayberry

Anyone have experience w/ Apache::Filter and handlers that set cookies..

It looks like they are being lost..

I found an article on an archive of someone saying they are having the same
problem and someone else said the solution was to just not send the header,
but you were fine as long as you were setting them... this does not appear
to be working for me..

Also what do people prefer Apache::Filter or Apache::OutputChain... I tried
OutputChain yesterday but no matter what I tried it wasnt actually
compressing the output (w/ Apache::GzipChain), and I followed the
documentation to a T.





RE: Apache::Filter and cookies

2001-04-10 Thread Geoffrey Young



 -Original Message-
 From: JR Mayberry [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, April 10, 2001 11:31 AM
 To: [EMAIL PROTECTED]
 Subject: Apache::Filter and cookies
 
 
 Anyone have experience w/ Apache::Filter and handlers that 
 set cookies..
 
 It looks like they are being lost..

I can set them just fine.  see the packages below...

 
 I found an article on an archive of someone saying they are 
 having the same
 problem and someone else said the solution was to just not 
 send the header,

in recent versions of Filter, calling send_http_header is basically a no-op
unless you are the last filter in the chain (I say basically because it will
set the content-type if you call send_http_header($type), though).

 but you were fine as long as you were setting them... this 
 does not appear
 to be working for me..
 
 Also what do people prefer Apache::Filter or 
 Apache::OutputChain... 

I think OutputChain is getting deprecated.  it is rather old and hasn't been
updated in a while.

Ken (somehow:) manages to keep tweaking Filter and more and more modules are
taking advantage of it.

 I tried
 OutputChain yesterday but no matter what I tried it wasnt actually
 compressing the output (w/ Apache::GzipChain), and I followed the
 documentation to a T.
 
 

HTH

--Geoff

package Custom::One;

use Apache::Constants qw( OK );
use strict;

sub handler {
  my $r = shift;

  $r = $r-filter_register;

  # try both ways...
  my $cookie = Apache::Cookie-new($r,
 -name=  "foo",
 -value   =  "492f183ad42ec80fc84d",
 -path=  "/",
 -expires =  "+10d"
   );
  $cookie-bake;

  $r-headers_out-set('Set-Cookie' = "name=bar");
  $r-send_http_header('text/plain');
  print "filter one...\n";
  return OK ;
}

1;
package Custom::Two;

use Apache::Constants qw( OK );
use strict;

sub handler {
  my $r = shift;

  $r = $r-filter_register;
   
  my $fh = $r-filter_input;
  local $/;
  my $string = $fh;

  $r-send_http_header('text/plain');
  print $string, "filter two...\n";
  print join "\n", $r-headers_out-get('Set-Cookie');
  return OK ;
}

1;