Hi Stas and all;

Here is a test that shows the cookie not able to be retrieved from the
env.

# file t/apache/cookie.t
use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest;

plan tests => 4;

my $module = 'TestApache::cookie';
my $location = "/$module";
my $cookie = 'foo=bar';

for (qw/header env/) {
    my $res = GET "$location?$_", 'Set-Cookie' => $cookie;

    ok t_cmp(200, $res->code,
             "status == 200");

    ok t_cmp(qr{bar}, $res->content,
             "content is 'bar'");
}

# file: t/response/TestApache/cookie.pm
package TestApache::cookie;

use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::Const -compile => 'OK';

sub handler {
    my $r = shift;
    $r->subprocess_env;
    my $header = $r->headers_in->{'Set-Cookie'} || '';
    my $env    = $ENV{HTTP_COOKIE} || $ENV{COOKIE} || ''; # from CGI::Cookie

    my ($key, $val) = split '=', $r->args eq 'header' ? $header : $env;
    defined $val && $r->write($val);

    return Apache::OK;
}

1;
__END__
~


Only thing that is curious is that the cookie is not in the ENV even
though this a PerlResponseHandler -- when I was working on porting my auth
stuff, the cookie _was_ in the ENV at that stage, just not in earlier
stages (ie PerlAccessHandler).

Hope this is what you wanted Stas ... :)

- nick

-- 

~~~~~~~~~~~~~~~~~~~~
Nick Tonkin   {|8^)>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to