[vwnc] Wrong format of HTTP cookie expiry date

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Wrong format of HTTP cookie expiry date

Holger Kleinsorgen-3
Howdy,

deleting a cookie in Seaside is done the following way:

   WAResponse>>deleteCookieAt: key
     "Delete the cookie in the browser"
     self addCookie: ((WACookie key: key value: '')
       expireIn: (Duration days: -10000);
       yourself)

if a German locale is installed, the cookie is marshaled by
SetCookieValue>>expiresPrintString the following way:

   TimestampPrintPolicy
      print: GMTSeconds
      using: 'ddd, dd mmm yyyy hh:mm:ss GMT'

resulting in:

   Set-cookie: MyCookie=;expires=di, 28 Okt 1980 11:53:14 GMT;path=/

Because the cookie date format is wrong, Firefox 2.0.0.12 doesn't delete
the cookie. And when the cookie happens to be the session cookie,
"WAApplication>>handleRequest:" will response with a redirect to the
application url itself. Luckily, Firefox gives up after a few redirects.

My preliminary fix looks like this:

   SetCookieValue>>expiresPrintString
      "Return a properly formatted date string using GMT."

      | GMTSeconds policy |
      GMTSeconds := Timestamp fromSeconds:
         (TimeZone reference convertLocalSecondsToGMT:
           self expires asSeconds).
      policy := TimestampPrintPolicy formatTokensFor:
         'ddd, dd-mmm-yyyy hh:mm:ss GMT'.
      ^(Locale named: #C) timePolicy print: GMTSeconds policy: policy

(storing the policy somewhere would be even better ;)
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc