[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.
[snip]
> With the CookieName directive it would look like:
> Variable    MERCHANT_ID        1001
> .
> .
> Cookies Yes
> CookieName	MV___MERCHANT_ID___SESSION_ID

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
                                         \d{1,3}\.
                                         \d{1,3}\.
                                         \d{1,3})
                                     # A user name or domain
                                     |   ([A-Za-z0-9][-\@A-Za-z.0-9]+) )?
                                     \b/x)
     {
         $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 
bugs.

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

HTH,
Jon

--
Jon Jensen
End Point Corporation
http://www.endpoint.com/
Software development with Interchange, Perl, PostgreSQL, Apache, Linux, ...


More information about the interchange-users mailing list