[ic] CookieName directive fails

Jon Jensen jon at endpoint.com
Fri Jul 22 12:00:42 EDT 2005

On Fri, 22 Jul 2005, Bruno Cantieni wrote:

> I'm having trouble getting CookieName to work on a "merchant network"
> consisting of about 40 catalogs.
> With the CookieName directive it would look like:
> Variable    MERCHANT_ID        1001
> .
> .
> Cookies Yes

I presume you have ParseVariables Yes before those directives, right?

I've not used CookieName before, but from looking at the code is would 
appear that you need to also set a CookiePattern. See Vend::Dispatch:

     elsif ($::Instance->{CookieName} and defined $CGI::cookie) {
         $CGI::cookie =~ m{$::Instance->{CookieName}=($Vend::Cfg->{CookiePattern})};
         $seed = $sessionid = $1;
         $::Instance->{ExternalCookie} = $sessionid || 1;
         $Vend::CookieID = $Vend::Cookie = 1;
     elsif (defined $CGI::cookie and
          $CGI::cookie =~ /\bMV_SESSION_ID=(\w{8,32})
                                 [:_] (
                                     (   \d{1,3}\.   # An IP ADDRESS
                                     # A user name or domain
                                     |   ([A-Za-z0-9][-\@A-Za-z.0-9]+) )?
         $sessionid = $1
             unless defined $CGI::values{mv_pc} and $CGI::values{mv_pc} eq 'RESET';
         $CGI::cookiehost = $3;
         $CGI::cookieuser = $4;
         $Vend::CookieID = $Vend::Cookie = 1;

If you set CookieName, then a different code block is called which
requires a CookiePattern (a regular expression). If you don't set
CookieName, a hard-coded cookie pattern is used, in the next block.

Interestingly, the $CGI::cookiehost and $CGI::cookieuser won't be set if 
you use a custom CookieName, and the mv_pc=RESET trick to clear your 
session for testing won't work either. I think those could be considered 

I'm interested to hear if setting CookiePattern fixes your problem.


Jon Jensen
End Point Corporation
Software development with Interchange, Perl, PostgreSQL, Apache, Linux, ...

More information about the interchange-users mailing list