httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <>
Subject [apreq-2] cookies
Date Tue, 27 Jul 2004 01:23:44 GMT
I'm having a problem with cookies in a simple handler;
this is with the current apreq-2 cvs, current mod_perl-1.99
cvs, and Apache/2.0.50, both on Win32 (perl-5.8.4,
multithreaded) and Linux (perl-5.8.5, non-multithreaded).
All the supplied tests passed on both, save for a couple of
(I think) unrelated minor issues. The handler is :
package Apache::Fail;
use strict;
use warnings;
use Apache::Request;
use Apache::Cookie;
use Apache::RequestRec;
use Apache::RequestUtil;
use Apache::Const -compile => qw(OK);
my $cookie_name = 'cookie_name';

sub handler {
  my $r = shift;
  my $mirror;
  my $req = Apache::Request->new($r);
  my %cookies = Apache::Cookie->fetch($r);
  if (my $c = $cookies{$cookie_name}) {
    $mirror = $c->value;
  else {
    my $host = $req->param('key') || 'default';
    my $cookie = Apache::Cookie->new($r, name => $cookie_name,
                                     value => $host);
    $mirror = $host;
with configuration

PerlModule Apache::Fail
<Location /fail>
  SetHandler perl-script
  PerlResponseHandler Apache::Fail

If I call this as
with no cookies present, then the cookie gets created
with the proper value. However, if I then reload
the page, and so try to use the stored cookie, I get
many instances of
  Could not find specified socket in poll list.:
    Skipping bad NAME=VALUE pair: cookie
    Skipping bad NAME=VALUE pair:
    Skipping bad NAME=VALUE pair:
until I have to kill the server.

The problem seems to be the presence of '_' in the
cookie name - if I use instead a name like
   my $cookie_name = 'cookiename';
then it works. I thought though that it was OK
to have underscores in the cookie name?

best regards,

View raw message