Since I'm going on vacation as soon as I fix this problem, I decided I'd
better try again.  I didn't write the crappy cookie with the equal sign
but my code has to deal with it...

Here's a good fix for WebUtils.Cookie.py around line 518:

# @@ JCJ - allow equal signs in the cookie value.
#_LegalCharsPatt  = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{]*"
_LegalCharsPattKey    = r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{]*"
_LegalCharsPattValue  =
r"[\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{=]*"
_CookiePattern = re.compile(
    r"(?x)"                       # This is a Verbose pattern
    r"(?P<key>"                   # Start of group 'key'
    ""+ _LegalCharsPattKey +""    # Any word
    r")"                          # End of group 'key'
    r"\s*=\s*"                    # Equal Sign
    r"(?P<val>"                   # Start of group 'val'
    r'"(?:[^\\"]|\\.)*"'            # Any doublequoted string
    r"|"                            # or
    ""+ _LegalCharsPattValue +""    # Any word 
    r")"                          # End of group 'val'
    r"\s*;?"                      # Probably ending in a semi-colon
    )


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jeff
> Johnson
> Sent: Thursday, September 20, 2001 5:50 PM
> To: Geoff Talvola; Love, Jay; [EMAIL PROTECTED]
> Subject: RE: [Webware-devel] Bad cookies hang Webkit
> 
> 
> Well, I found the person with the bad cookies.  The offending 
> cookie is
> has two equal signs in it!  Is that legal??
> "WWWLYCOS=SATISFACTIONSURVEY=N;"
> 
> Does anyone have a suggestion of how we can handle this exception
> gracefully or improve the parser?
> 
> 
> I printed out the offending cookie and the exception below.
> 
> lubid=010000508BD3046104E43BAA159C000AC84600000000;
> WWWLYCOS=SATISFACTIONSURVEY=N; _SID_=2001092017242334450; 
> countyno=127;
> state=FL; city=Barberville
> 
> Traceback (most recent call last):
>   File "/usr/Webware/Webware/WebKit/HTTPRequest.py", line 47, in
> __init__
>     self._cookies.load(self._environ['HTTP_COOKIE'])
>   File "WebUtils/Cookie.py", line 605, in load
>     for K,V in self.items():
>   File "WebUtils/Cookie.py", line 625, in __ParseString
>     n = len(str)     # Length of string
> IndexError: string index out of range
> 
> _______________________________________________
> Webware-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-devel
> 

<<winmail.dat>>

Reply via email to