Hi -- I have a site which mananges photos for
visitors. I log cookies to a log file using the
recipe from
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler.
Here's the code
package CookLog;
use strict;
use warnings;
use Fcntl qw(:flock);
sub handler {
my $r = shift;
my $entry = sprintf(qq(%s|%s|%s|%s|%s\n),
$r->connection->remote_ip,
scalar(time),
$r->status,
$ENV{'HTTP_COOKIE'} || '-',
$r->uri);
my $logfile =
Apache::server_root_relative($r->pool,
"logs/mycookies_log");
open my $fh, ">>$logfile" or die "can't open
$logfile: $!";
flock $fh, LOCK_EX;
print $fh $entry;
close $fh;
return &Apache::OK;
}
This code works fine for visitors on the core site.
When a visitor is on a different site (sister site,
different domain) views an image back on the core site
(the sister site uses an image tag pointing back to
the core site), a cookie (if any) from the core site
is not detected and logged.
Is the problem with how I am obtaining the cookie from
the environment? Or is the problem some apache
setting? Or is the problem that I am misunderstanding
how cookies are sent? If the last, is there a way for
a request (say, an image) to server of site "A" off a
site "B" page to return the site "A" cookies to site
"A"?
Thanks
-TO
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com