| Description: |
If one use Safari 3 under Mac OS X.5.6 and you want to set a cookie with ::ncgi::setCookie, you won't be able to get data back because it will add trailing spaces at the end of each cookie value.
If you have a look at ~/Library/Cookies/Cookies.plist it looks like this:
<dict>
<key>Created</key>
<real>251193654.78859401</real>
<key>Domain</key>
<string>localhost</string>
<key>Expires</key>
<date>2009-12-18T08:00:54Z</date>
<key>Name</key>
<string>SID </string>
<key>Path</key>
<string>/ </string>
<key>Value</key>
<string>foo </string>
</dict>
The quick way to make it works again is to remove each space between variable and semi-colon in ::ncgi::setCookie :
proc ::ncgi::setCookie {args} {
variable cookieOutput
array set opt $args
set line "$opt(-name)=$opt(-value);"
foreach extra {path domain} {
if {[info exists opt(-$extra)]} {
append line " $extra=$opt(-$extra);"
}
}
if {[info exists opt(-expires)]} {
switch -glob -- $opt(-expires) {
*GMT {
set expires $opt(-expires)
}
default {
set expires [clock format [clock scan $opt(-expires)] \
-format "%A, %d-%b-%Y %H:%M:%S GMT" -gmt 1]
}
}
append line " expires=$expires;"
}
if {[info exists opt(-secure)]} {
append line " secure "
}
lappend cookieOutput $line
}
I'm unable to say if it's a ncgi bug, but as far as I can see, it works again with Safari and OS X.5.6 and it doesn't break anything for others browsers / Oses.
|