Hi!
Setting Cookie via headers_out() function does not work :(
see the code:
==
..
use Apache;
..
sub handler {
my( %form, $ua, $r, $key, $value);
$r = Apache->request();
my $headers_out = $r->headers_out;
my $headers_in = $r->headers_in;
my %h = $r->headers_in();
$headers_out->{Cookie} = 'SESSION=1A91933A; domain=acme.com';
$r->send_http_header('text/html');
print '<html><head></head><body><h2>Data:</h2>';
print '<b>Cookie: </b>' . $headers_in->{Cookie} . '<br>';
print '<h3>Headers:</h3><pre>';
while(($key, $value) = each(%h)) {
print "$key -> $h{$key} \n";
}
print '</pre>';
print '</body></html>';
} # end of handler.
..
==
but cookie works when I replace $r->send_http_header('text/html') with
print "Content-Type: text/html\n\n";
print "Set-Cookie: lala=foo";
What's the problem?
Best regards,
******************************************************
Vlad A. Safronov vlads@comptek.ru
Setting Cookie via headers_out() function does not work :(
see the code:
==
..
use Apache;
..
sub handler {
my( %form, $ua, $r, $key, $value);
$r = Apache->request();
my $headers_out = $r->headers_out;
my $headers_in = $r->headers_in;
my %h = $r->headers_in();
$headers_out->{Cookie} = 'SESSION=1A91933A; domain=acme.com';
$r->send_http_header('text/html');
print '<html><head></head><body><h2>Data:</h2>';
print '<b>Cookie: </b>' . $headers_in->{Cookie} . '<br>';
print '<h3>Headers:</h3><pre>';
while(($key, $value) = each(%h)) {
print "$key -> $h{$key} \n";
}
print '</pre>';
print '</body></html>';
} # end of handler.
..
==
but cookie works when I replace $r->send_http_header('text/html') with
print "Content-Type: text/html\n\n";
print "Set-Cookie: lala=foo";
What's the problem?
Best regards,
******************************************************
Vlad A. Safronov vlads@comptek.ru