[Zope] cgi_module_publish cookie prsing errors?

Evan Gibson egibson@connect.com.au
Tue, 30 Mar 1999 12:35:23 +1000


On Mon, Mar 29, 1999 at 04:59:39PM +0000, Ty Sarna wrote:
> All of my "real" sites are still running under Principia. Recently a
> number users of these sites have had their machines upgraded. Those now
> using the latest versions of IE and Netscape are unable to access the
> sites now unless they turn off cookies, or they get an error in
> cgi_module_publish to do with parsing cookies. (I'm still trying to get
> someone to send me the actual error text).
> 
> Anyone out there using Principia still? Have you seen this?
> Anyone using Zope seen this?

Yes, I've seen it in Principia and Bobo for cookies in the form:

.com.au  TRUE    /       FALSE   933422008       MC1 GUID=083F5B8E21DE11D28B2C08002BB74F3F

The two problems being that cookies are usually only seen by the domain
that registers them, but some badly configured servers (most probably
Microsoft servers by the look of the cookies) only list the last two parts
of the domain name. This is fine for blah.com, but for overseas domains
like blah.com.au it means the cookie is returned for ALL .com.au sites.

This wouldn't be a problem, but since the cookies are returned to Principia
in the form:

MC1=GUID=083F5B8E21DE11D28B2C08002BB74F3F

parse_cookie breaks since it looks for key value pairs WITHOUT an equals
sign on either side. The extra = really confuses it.
To fix it change the re in parse_cookies in cgi_module_publisher.py from:

                 parmre=regex.compile(
                     '\([\0- ]*'
                     '\([^\0- ;,=\"]+\)=\([^\0;-=\"]*\)'
                     '\([\0- ]*[;,]\)?[\0- ]*\)'
                     ),
 
to:

                 parmre=regex.compile(
                     '\([\0- ]*'
                     '\([^\0- ;,=\"]+\)=\([^\0;-\"]*\)'
                     '\([\0- ]*[;,]\)?[\0- ]*\)'
                     ),
 


-- 
  Evan ~ThunderFoot~ Gibson    ~ nihil mutatem, omni deletum ~
      May the machines watch over you with loving grace.